Message Splitter Simple Code

Source: Internet
Author: User

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;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.