Message splitter principle, here is not in detail, you can query Google, the following provides a short code implementation
Each message has WParam and lParam, such as wm_command,wparam containing two different values, including:
WParam: The low byte is the ID of the control, and the high byte is the notification code Notifycode
LParam: Cast to the handle value of a button or control hWndCtl
#include <windowsx.h>
#define CHHANDLE_DLGMSG (HWND, message, FN) Case: return (Setdlgmsgresu LT (hwnd, umsg, handle_# #message (HWND), (WParam), (LParam), (FN)))
int_ptr CALLBACK Dlg_oninitdialog (hwnd hwnd, HWND Hwndfocus, LPARAM LPARAM)
{
SetWindowText (hwnd, L "message splitter");
return TRUE;
}
Int_ptr CALLBACK Dlg_oncommand (HWND hwnd, INT ID, HWND hwndctl, UINT codenotify)
{
switch (ID)
{
Case IDOK:
{setwindowtext (hwnd, L "message splitter OK");
break;
}
//LoWord (wParam) = = Idok
}
return TRUE; The message handler for the
}
//About box.
Int_ptr CALLBACK About (HWND hdlg, UINT umsg, WPARAM WPARAM, LPARAM LPARAM)
{
switch (umsg)
{
Chha Ndle_dlgmsg (Hdlg, Wm_initdialog, Dlg_oninitdialog);
Chhandle_dlgmsg (hdlg, WM_COMMAND, Dlg_oncommand);
}
Return (INT_PTR) FALSE;
}