You are here:

C++/Basic Win32 Window

Advertisement


Question
Hi I need your help.

I am using Windows XP Pro, and I use Microsoft Visual Studio.NET 2003 and Visual Studio 6.

I tried to make a simple Win32 application. I am able to display empty window on the screen, but this time I want to remove the title bar, so that the user cannot move, minimise, maximise, or close the window or even through system menu.

I tried to change the value of WINCLASSEX object property the style to other value CS_..., and the parameter of CreateWindowEx to other WS_..., the 4th argument, but still doesn't work.

In Visual Basic 6, I can do that easily by changing the property BorderStyle of the form to "0 - None".

Thanks for help, thank you.

Answer
Hello Junaidi, thanks for the question.

In order to do this, you should use the CreateWindow function will the following parameters:

#define WINDOW_WIDTH  640
#define WINDOW_HEIGHT 480

CreateWindow(CLASSNAME,   "Basic Window",
WS_POPUP| WS_VISIBLE,      
(GetSystemMetrics(SM_CXSCREEN)>>1) - (WINDOW_WIDTH>>1),
(GetSystemMetrics(SM_CYSCREEN)>>1) - (WINDOW_HEIGHT>>1),
WINDOW_WIDTH,WINDOW_HEIGHT,NULL,NULL,hinstance,NULL);


That will create a 640 x 480 window with no title bar, as defined by WS_POPUP. It doesn't have to be 640 x 480, any valid screen resolution will do. The hinstance used is the first HINSTANCE parameter passed into WinMain. Notice the #define's make for easy resolution changing.

I hope this information was helpful.

- Eddie

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Eddie

Expertise

I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by ExpertRating.com. I also know a good deal about graphics via OpenGL, and GUIs.

Experience

I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2016 About.com. All rights reserved.