C++/Basic Win32 Window
Expert: Eddie - 11/23/2004
QuestionHi 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.
AnswerHello 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