// CMyMFCmsgDlg 对话框
class CMyMFCmsgDlg : public CDialogEx
{
// 构造
public:
CMyMFCmsgDlg(CWnd* pParent = NULL); // 标准构造函数
// 对话框数据
enum { IDD = IDD_MYMFCMSG_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
HICON m_hIcon;
// 生成的消息映射函数
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
afx_msg LRESULT OnMyMsgUnreg(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnMyMsgReg(WPARAM wParam, LPARAM lParam);
public:
afx_msg void OnBnClickedButton1();
afx_msg void OnBnClickedButton2();
};
// CMyMFCmsgDlg 对话框
#define WM_MY_MSG_UNREG WM_USER+101
static UINT NEAR MY_MSG_REG = RegisterWindowMessage(_T("MSG_REG"));
BEGIN_MESSAGE_MAP(CMyMFCmsgDlg, CDialogEx)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_MESSAGE(WM_MY_MSG_UNREG, &CMyMFCmsgDlg::OnMyMsgUnreg)
ON_REGISTERED_MESSAGE(MY_MSG_REG, &CMyMFCmsgDlg::OnMyMsgReg)
ON_BN_CLICKED(IDC_BUTTON1, &CMyMFCmsgDlg::OnBnClickedButton1)
ON_BN_CLICKED(IDC_BUTTON2, &CMyMFCmsgDlg::OnBnClickedButton2)
END_MESSAGE_MAP()
afx_msg LRESULT CMyMFCmsgDlg::OnMyMsgUnreg(WPARAM wParam, LPARAM lParam)
{
MessageBox(_T("OnMyMsgUnreg"));
return 0;
}
afx_msg LRESULT CMyMFCmsgDlg::OnMyMsgReg(WPARAM wParam, LPARAM lParam)
{
MessageBox(_T("OnMyMsgReg"));
return 0;
}
void CMyMFCmsgDlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
this->PostMessageW(WM_MY_MSG_UNREG);
}
void CMyMFCmsgDlg::OnBnClickedButton2()
{
// TODO: 在此添加控件通知处理程序代码
this->PostMessageW(MY_MSG_REG);
}