BEGIN_MESSAGE_MAP(CTestDlg, CDialog)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton1)//共用函数OnButton1
END_MESSAGE_MAP()
void CTestDlg::OnButton1()
{
MessageBox("Button1");
}
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton1)//共用函数OnButton1
END_MESSAGE_MAP()
void CTestDlg::OnButton1()
{
MessageBox("Button1");
}
lpEntry->pfn, pExtra, lpEntry->nSig, pHandlerInfo);函数中还能看到nID,到回调OnButton1() 函数时就不能看到了。
楼主:为什么不变通一下:既然这么麻烦,索性用不同一ID来映射?毕竟写程序是一种工程实现活动,有些东西实在想不出来,也不一定要逼着自己去搞。
{
// TODO: Add your control notification handler code here
_AFX_THREAD_STATE* pThreadState = AfxGetThreadState();
MessageBox(pThreadState->m_lastSentMsg.wParam==IDC_BUTTON1?"1":"2");
}