Home » Category » Microsoft Visual C & C++

Microsoft Visual C & C++: How send a window a user define message

202| Wed, 06 Feb 2008 11:13:00 GMT| hbb| Comments (2)
I want to send a window a user defined message, I just simply add a #define ...
line in the .h file, and use PostMessage(...) to try to send a message to a window,but it doesnt seem to work,so any other work I should do?
thanks

Keywords & Tags: send, window, user, define, message, microsoft, visual c++, vc

URL: http://www.7prog.com/visual-c-c++/143063/
 
«« Prev - Next »» 2 helpful answers below.
You also need to include the message in your receiving windows message map via on_message.

Syntax
// inside the class declaration
afx_msg LRESULT OnMyMessage(WPARAM wParam, LPARAM lParam);

...

#define WM_MYMESSAGE (WM_USER + 100)

BEGIN_MESSAGE_MAP(CMyWnd, CMyParentWndClass)
ON_MESSAGE(WM_MYMESSAGE, OnMyMessage)
END_MESSAGE_MAP()

LRESULT CMyWnd::OnMyMessage(WPARAM WParam, LPARAM LParam)
{
return (LRESULT)0;
}

Next ...

hbb | Sat, 10 Nov 2007 05:16:00 GMT |

thanks, it works

hbb | Sat, 10 Nov 2007 05:17:00 GMT |

Microsoft Visual C & C++ Hot Answers

Microsoft Visual C & C++ New questions

Microsoft Visual C & C++ Related Categories