Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

messages part 2 1

Status
Not open for further replies.

bubak

Programmer
Jun 25, 2001
208
SK
When I send a message :
----
NMHDR nmhdr;
nmhdr.hwndFrom = GetSafeHwnd();
nmhdr.code = WM_RBUTTONDOWN;
GetParent()->PostMessage(WM_RBUTTONDOWN,(WPARAM)m_dwFaceColor,(LPARAM)&nmhdr);
---
and catch it with
-----
ON_MESSAGE(WM_RBUTTONDOWN,OnRBGet)
-----
it works. But when I send message with
-----------
NMHDR nmhdr;
nmhdr.hwndFrom = GetSafeHwnd();
nmhdr.code = WM_RBUTTONDOWN;
GetParent()->PostMessage(WM_NOTIFY,(WPARAM)m_dwFaceColor,(LPARAM)&nmhdr);
-------
and catch it with:
-------------------
ON_NOTIFY_RANGE(WM_RBUTTONDOWN,IDW_DAYSCHEDULE_CB1,IDW_DAYSCHEDULE_CB6,OnNotifyGet)
--------------
it doesn't. Do anyone of U see an error there? Where is the problem?
thx
bubak
 
I think you need to read a little about the different types of Windows messages. Messages such as WM_LBUTTONDOWN are sent to a window when the user makes some action, such as clicking on the window with the mouse. Of course, you can simulate this by sending such a message yourself. These messages are normally handled in MFC with the corresponding ON_WM_LBUTTONDOWN map entry. You can use the generic ON_MESSAGE but it's really intended for user defined messages.

Notifications are messages sent from a child window (a button, say) to its parent (usually a dialog window) to tell the parent something happened, e.g., the user just clicked me, or from things like menu entries. These messages are sent as WM_COMMAND messages with the id of the control and the id of the notification, e.g. BN_CLICKED. Such notifications are normally handled by ON_CONTROL or ON_CONTROL_RANGE which indicate the id of the control (or range of ids), and the notification.

Some more complex controls use the WM_NOTIFY message, which is caught by ON_NOTIFY or ON_NOTIFY_RANGE. ON_NOTIFY_RANGE will not catch a WM_LBUTTONDOWN, or any other Windows message than WM_NOTIFY. :) Hope that this helped! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top