How do I make a window fit to the desktop

I don't want to make it a chromeless full screen window. Just like when notepad is full screened.

Thanks.
I wish it was that simple....but that looks like something for dhtml?

I should've been more specific. I mean, how do I, in windows GDI, create a window that is max'd size upon creation?

If you are calling CreateWindow, set the WS_MAXIMIZE flag to the style parameter
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
Thanks guys, I'm using an api that hides the CreateWindow function from me and for it to properly initialize I'll have to use their version of it which only takes in height/width without the dwStyle..

Is there a way to set the dwstyle after the window has been created?
Get the handle to the window and use SetWindowPos() with the appropriate resize flags.
Last edited on
The thing is, all the resize functions don't accomplish what 'maximize' does, which is more than just making a window full screen. It also fits to taskbar, disables edge window resize and disables action bar window placement.

Another option is, through the function SetWindowPos you can resize the window dimensions using expressions with the values returned from GetSystemMetrics(SM_CXSCREEN) (the monitor display width) and GetSystemMetrics(SM_CYSCREEN) (the monitor display height).
you said you don't have access to CreateWindow, but what about ShowWindow() [which Lamblion has suggested], then (since i'm assuming you are writing the windowproc) you can just call ShowWindow() in the WM_CREATE case in the windowproc. or, if you really need to, just use the SendMessage() function and send a WM_SYSCOMMAND with SC_MAXIMIZE (see http://msdn.microsoft.com/en-us/library/ms646360%28VS.85%29.aspx for more details on WM_SYSCOMMAND and http://msdn.microsoft.com/en-us/library/ms644950%28VS.85%29.aspx for SendMessage() ).
Topic archived. No new replies allowed.