It works fine without a static edge.
Can anyone explain why?
The function Weirdness is trimmed down icon moving function, I'm not really
trying to set an icon to the postion it is already in.
Cheers,
Tom
void CMyWindow::Weirdness(CWnd& window)
{
CRect rect;
window.GetClientRect(&rect);
window.ClientToScreen(&rect);
ScreenToClient(&rect);
int height = rect.Height();
window.SetWindowPos(0, rect.left, rect.top, rect.Width(), rect.Height(),
SWP_NOACTIVATE | SWP_NOZORDER );
}
GetClientRect gets the inside of the window, its 'client' area inside any
border. But SetWindowPos sets the outside of the window. Try changing from
GetClientRect to GetWindowRect.
--
Scott McPhillips [VC++ MVP]
> If I call this function and pass in a CStatic with a static edge, it
> shrinks
> the window by 2 pixels each time.
>
> It works fine without a static edge.
>
> Can anyone explain why?
>
> The function Weirdness....
No weirdness here:
> window.GetClientRect(&rect);
> window.ClientToScreen(&rect);
> ScreenToClient(&rect);
>
> int height = rect.Height();
>
> window.SetWindowPos(0, rect.left, rect.top, rect.Width(), rect.Height(),
> SWP_NOACTIVATE | SWP_NOZORDER );
You're getting the client area and setting the full window size to be what
its client area previously was. And it appears to be working perfectly :-)
Check out GetWindowRect()
Isn't it a pain that computers never do what you want, but rather they do
what you tell them to? :-)
Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mozartists/mailinglist.htm