Skip to main content
GameDev.net gamedev.net
🔒 Locked

CreateWindow

Started by Maxxes Oct 9, 2001 at 4:45 AM 10 replies 2.1k views
Original Post
Maxxes
Maxxes
Does anyone know why: - when I use the WS_MAXIMIZE style my window doesn''t appear maximized? - GetSystemMetrics(SM_CXMAXIMIZED) returns a number somewhat bigger than my screenresolution (1032 when 1024x768, 808 when 800x600) - when I specify x and y to be (0,0) my window starts not exactly at the left top but a little to the right and bottom. As you''ve probably guessed, all I want is a window that starts out maximized. Not a very difficult task I thought, still...
Zeke
Zeke
Im not too sure about this but when you call ShowWindow() then you can pass SW_MAXIMIZED or something and it should start out maximized (if you dont call ShowWindow() then call it after you CreateWindow() i think)
Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
Maxxes
Maxxes
Well that works!

But now my window is maximized up to the point that is hides the taskbar

And all I want is a normal maximized window that covers the whole screen except the taskbar.
Zeke
Zeke
Hmmm thats peculiar, ive not encountered that problem. Ive just looked it up in msdn and it says that the first time ShowWindow() is called it should use the nCmdShow passed into WinMain and then int subsequent calls use
SW_MAXIMIZE oe whatever. I wouldnt have thought this is the problem but maybe you should try doing:

ShowWindow(hWnd, nCmdShow);
ShowWindow(hWnd, SW_MAXIMIZE);

Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
Maxxes
Maxxes
I also looked it up (many times)

And i did try just what you suggested

same result
Maxxes
Maxxes
Well when I add the WS_MAXIMIZEBOX style in CreateWindow I get a normal maximized window with ShowWindow(hwnd, SW_MAXIMIZE)

But I DON''T want a maximize box. I don''t want users to be able to resize my window.
Boki
Boki
This works for me:

CreateWindow as usual and than call
  
ShowWindow( hWnd, SW_MAXIMIZE );
UpdateWindow( hWnd );


GetSystemMetrics( SM_CXMAXIMIZED ) returns a grater number to hide the thick border of a window. To get the working area (the space of the screen without the taskbar) call SystemParametersInfo( SPI_GETWORKAREA, 0, &rc, FALSE );

Hope this hepls,
Bjørn.
We are boki. The rest is known.
Maxxes
Maxxes
quote:
CreateWindow as usual and than call


It works for me also except that I don't want a maximize box and without a maximize box it covers the taskbar???

I want my window to have only two possible states: maximized or minimized, no more, no less.

Edited by - maxxes on October 9, 2001 8:50:05 AM
Boki
Boki
With these window styles it works for me:

WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX

Bjørn.
We are boki. The rest is known.
Maxxes
Maxxes
Sorry Boki, those styles combined with ShowWindow(hwnd, SW_MAXIMIZE) again results in a window that overlaps the taskbar.

Also, unlike normal maximized windows, its movable.

So, is there really noone who knows how to create a window that:

1. is maximized (ie: covering the whole screen but NOT the taskbar and is NOT movable)

2. doesn''t have an active maximize box

Boki
Boki
Funny thing. I''m able to create a window that is maximized but whose maximize button is disabled - it can''t be moved, but a dbl click in the caption restores the window, so one have to capture WM_NCLBUTTONDBLCLK to disable this. Seems that ther is something else wrong with your code...

BTW: AP this is a simpler way to prevent that the user may move the window (even thought I don''t like progs that behave that way):
  
case WM_MOVING:
// These next statements keep the drag rectangle from moving

// when the user does attempt to move the window

GetWindowRect( hWnd, (LPRECT)lParam );
return TRUE;


Bjørn.
We are boki. The rest is known.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.