Dave's Brain

Browse - programming tips - win32 what messages are sent to my control

Date: 2009may31
Platform: 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
}
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2012, 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.
Advertisements: