0
votes

I have a layered window set up in my MFC application. I have set up my own derivation of CDialog to allow me to customise various parts of how the window is rendered. Everything works fine right up until I start worrying about minimise and maximise.

If you click minimise or maximise then the window reacts exactly as you'd expect (ie exactly as it does when NOT using a layered window). However, when I restore the window something very odd happens.

The default client rectangle for my test window is 324x102. When I restore from the minimised state, for example, the cx and cy passed to OnSize is 994, 550. If I then do a GetClientRect (within OnSize) this is the size reported for the window. Weirdly, though if i do GetWindowRect I get the correct size back (though obviously including all my non-client areas).

Does anybody have any idea what is going on here and, more importantly, how I can fix it such that GetClientRect reports the CORRECT information?

Thanks in advance!

1

1 Answers

1
votes

I have come up with a sort of hack to solve this problem. In OnSize and OnMove I ignore the (c)x and (c)y that I receive and work everything out from a GetWindowRect. The application now reacts as expected. I have marked the code with a [HACK] comment. This does seem very odd though, I'd love to hear WHY this is happening.