Archived

This topic is now archived and is closed to further replies.

Densun

changing the client window size

Recommended Posts

Is there a function I can call to change the size of the client window? I don''t want to be stuck with the choices I made in CreateWindow (). I also have a question about CreateWindow (). Are the width and height specified the size the window will be, or the client window?

Share this post


Link to post
Share on other sites
you can use SetWindowPos() i think. look it up in the msdn it''s something starting with SetWindow...

in CreateWindow you specify the total size of the window, so if you say it should be 200pixels wide and the user has a default window frame of 10 pixels each, you will end up with a client area of 180p

Share this post


Link to post
Share on other sites
Those dimensions specify the dimensions of the entire frame of the window. If you want to change the size of the client area, try something like this:

RECT rect;

rect.left = rect.top = 0;
rect.right = width; rect.bottom = height;

AdjustWindowRect(&rect, style, FALSE);
SetWindowPos(hWnd, HWND_TOP, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE);

style is the stuff you used for the style parameter in CreateWindow or CreateWindowEx, like, say, WS_OVERLAPPEDWINDOW.

Now, if you''re using MFC, I think there''s a method in CWnd...how''s about that...I think it''s called AdjustWindowRect or something like that. And it''ll set your client area to whatever size you tell it. I *think*.

Share this post


Link to post
Share on other sites