Advertisement

MFC windows, layout?

Started by March 15, 2004 12:42 PM
3 comments, last by Tree Penguin 20 years, 11 months ago
Hi, i am currently working on code to render an animation but when resizing the window the right size i got a problem: using SetWindowPos(l,t,r,b) the window is resized to fit completely into that rectangle including caption and borders. Is there a way to resize the window specifying the new size of the view instead of the whole window? Or even more useful how is a window made up (where are borders or frameborders used and such)? I know the use of GetSystemMetrics but i dont know how a window is built up exactly (except the caption and that there are borders, don;t know which). Help please, thanks in advance!
Have you tried GetClientRect?

Love means nothing to a tennis player

My nothing-to-write-home-about OpenGL webpage. (please pardon the popups!)

Advertisement
Is there a function that is like SetClientRect (this function doesn't exist)? Else i'll just get the difference in size and add that to the size, this will work to i assume.

[edited by - Tree Penguin on March 15, 2004 3:53:49 PM]
You can use the AdjustWindowRect() or AdjustWindowRectEx() functions to modify your rectangle to include the additional space for things like the frame, menu, etc.

J.W.
I solved it this way:

g_scenewnd->SetWindowPos(NULL,0,0,rd.m_resx,rd.m_resy,SWP_SHOWWINDOW);
CRect r;
g_scenewnd->GetClientRect(&r);
rd.m_resx+=rd.m_resx-r.Size().cx;
rd.m_resy+=rd.m_resy-r.Size().cy;
g_scenewnd->SetWindowPos(NULL,0,0,rd.m_resx,rd.m_resy,SWP_SHOWWINDOW);

This topic is closed to new replies.

Advertisement