Here's a quick, general introduction to user-defined messages. I'm assuming you're using MFC here. 1. Define a message identifier. You can base it off of WM_USER or WM_APP:
#define WM_MY_MESSAGE (WM_APP + 1)
2. Declare a message handler in your dialog class:
afx_msg LRESULT OnMyMessage(WPARAM wParam,LPARAM lParam);
3. Add an entry to the message map for your dialog class:
BEGIN_MESSAGE_MAP(...)
// ...
ON_MESSAGE(WM_MY_MESSAGE,OnMyMessage)
// ...
END_MESSAGE_MAP()
4. Define your message handler:
LRESULT MyDialogClass::OnMyMessage(WPARAM wParam,LPARAM lParam)
{
// ...
}
5. Finally, send the message when needed:
my_dialog->SendMessage(WM_MY_MESSAGE,
(WPARAM)first_parameter,
(LPARAM)second_parameter);
where first_parameter and second_parameter are whatever values you want to send with the message.
Software Zen: delete this;
Fold With Us![^]