Why my custom CStatic derived control does not receive WM_SIZE message?

Posted by Michael P on Stack Overflow See other posts from Stack Overflow or by Michael P
Published on 2010-03-16T12:40:46Z Indexed on 2010/03/16 14:06 UTC
Read the original article Hit count: 309

Hello everyone!

I'm currently developing a custom control that derives from CStatic MFC class (Smart Device C++ project). I have created the control class using VC++ MFC class wizard, selecting CStatic class as its base class. I have used Class View to add OnSize event handler for my control class (I have selected WM_SIZE message from messages list), and new OnSize method has been created by Visual Studio along with ON_WM_SIZE() statement between BEGIN_MESSAGE_MAP(...) and END_MESSAGE_MAP(). The problem is that my control does not receive WM_SIZE thus OnSize method is never called - I used MoveWindow to change size of my control - its size changes as I have seen on dialog window but WM_SIZE message is never being sent. When I send WM_SIZE through SendMessage or PostMessage function - the control OnSize method is called normally. What do I wrong? I've read MSDN docs about CStatic control and there is no information that WM_SIZE message is never sent to a static control window.

Sorry for my bad English.

© Stack Overflow or respective owner

Related posts about mfc

Related posts about visual-c++