Begins the definition of your message map.



BEGIN_MESSAGE_MAP( theClass, baseClass )  

Parameters:

theClass
Specifies the name of the class whose message map this is.

baseClass
Specifies the name of the base class of theClass.


EX:

BEGIN_MESSAGE_MAP(CSystem_disk_power_cycle_STM32, CDialog)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_MESSAGE(WM_DEVICECHANGE, OnDeviceChange)
ON_WM_SYSCOMMAND()
ON_WM_TIMER()

ON_BN_CLICKED(IDC_BTN_SAVE, OnBtnSave)
// ON_MESSAGE(WM_GO_SYSTEM, OnUpdateMSG)

END_MESSAGE_MAP()




.
.
.
.
.


Header: afxmsg_.h

ON_MESSAGE
Indicates which function will handle a user-defined message.

Syntax

Copy
ON_MESSAGE( message, memberFxn ) 


ex:

#define WM_MYMESSAGE (WM_USER + 100)

BEGIN_MESSAGE_MAP(CMyWnd2, CWnd)
   ON_MESSAGE(WM_MYMESSAGE, OnMyMessage)
END_MESSAGE_MAP()

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

 LRESULT CMyWnd2::OnMyMessage(WPARAM wParam, LPARAM lParam)
{
   UNREFERENCED_PARAMETER(wParam);
   UNREFERENCED_PARAMETER(lParam);

   // Handle message here. 

   return 0;
}


.
.
.


WM_APP

Used to define private messages, usually of the form WM_APP+x, where x is an integer value.
#define WM_APP                          0x8000

Range Meaning

0 through WM_USER –1
Messages reserved for use by the system.

WM_USER through 0x7FFF  (0x0400) to (0x7FFF )
Integer messages for use by private window classes.

WM_APP through 0xBFFF (0x8000) to (0xBFFF)
Messages available for use by applications.

0xC000 through 0xFFFF
String messages for use by applications.

Greater than 0xFFFF
Reserved by the system.




https://msdn.microsoft.com/library/windows/desktop/ms644930
https://docs.microsoft.com/en-us/cpp/mfc/reference/message-map-macros-mfc
arrow
arrow
    全站熱搜

    天才R 發表在 痞客邦 留言(0) 人氣()