BEGIN_MESSAGE_MAP(CXXXDlg, CDialog)
//{{AFX_MSG_MAP(CXXXDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_TIMER()
//}}AFX_MSG_MAP
//这里的IDC_BUTTON_PORT_1和 IDC_BUTTON_START_ALL之间有很多个Button,并且ID连续
ON_COMMAND_RANGE(IDC_BUTTON_PORT_1, IDC_BUTTON_START_ALL, OnButtonPort)
ON_WM_DEVICECHANGE()
END_MESSAGE_MAP()
Use this macro to map a contiguous range of command IDs to a single message handler function. ON_COMMAND_RANGE(id1, id2, memberFxn ) Parameters id1 Command ID at the beginning of a contiguous range of command IDs. id2 Command ID at the end of a contiguous range of command IDs. memberFxn The name of the message-handler function to which the commands are mapped. Remarks The range of IDs starts with id1 and ends with id2. Use ON_COMMAND_RANGE to map a range of command IDs to one member function. Use ON_COMMAND to map a single command to a member function. Only one message-map entry can match a given command ID. That is, you can't map a command to more than one handler. For more information on mapping message ranges, see Handlers for Message-Map Ranges. There is no automatic support for message map ranges, so you must place the macro yourself.
afx_msg void OnCommandMy(WPARAM wParam, LPARAM lParam );
Handler functions for single commands normally take no parameters. With the exception of update handler functions, handler functions for message-map ranges require an extra parameter, nID, of type UINT. This parameter is the first parameter. The extra parameter accommodates the extra command ID needed to specify which command the user actually chose.
#define ON_COMMAND_RANGE(id, idLast, memberFxn) \
{ WM_COMMAND, CN_COMMAND, (WORD)id, (WORD)idLast, AfxSig_vw, \
(AFX_PMSG)(void (AFX_MSG_CALL CCmdTarget::*)(UINT))&memberFxn },
// ON_COMMAND_RANGE(id, idLast, OnFoo) is the same as
// ON_CONTROL_RANGE(0, id, idLast, OnFoo)
pop edi pop esi pop ebx add esp, 48h cmp ebp, esp call __chkesp (0041e680) mov esp, ebp pop ebp ret 8(两个参数出栈)
mov esp, ebp pop ebp ret 8两个参数出栈)
afx_msg void OnButtonPort(UINT nID);
CWnd *pWnd = GetFocus(); int nPortID = pWnd->GetDlgCtrlID() ;
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有