Dave's Brain

Browse - Programming Tips - What messages are sent to my MFC control?

Date: 2009may31
Framework: MFC
Language: C/C++

Q.  What messages are sent to my MFC control?

A.  To see what messages your MFC is getting override the OnWndMsg() function.

In your .h file add this:

class CMyButton : public CButton { ... // ADD THIS virtual BOOL OnWndMsg( UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult ); ... };
In your .cpp file add this:
CMyButton::BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult) { printf("CMyButton got windows messsage 0x%0x\n", message); return FALSE; // Say you have not processed the message }

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.