Advertisement

changing the client window size

Started by April 09, 2000 09:12 AM
1 comment, last by Densun 24 years, 8 months ago
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?
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
Advertisement
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(▭, 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*.

This topic is closed to new replies.

Advertisement