VC自定义消息
时间:2010-12-21 来源:kenter
#define WM_MY_MESSAGE (WM_USER+100)
在dlg.cpp中添加
UINT CTestMessageDlg::OnMyMessage(WPARAM wParam, LPARAM lParam)
{
// TODO: 处理用户自定义消息...
CString *dd = (CString*)lParam;
AfxMessageBox(*dd);
return 0;
}
ON_MESSAGE(WM_MY_MESSAGE, OnMyMessage)
dlg.h添加
afx_msg UINT OnMyMessage(WPARAM wParam, LPARAM lParam);
测试
代码 void CTestMessageDlg::OnButton1()
{
// TODO: Add your control notification handler code here
CString dd = "Hello World";
::SendMessage(m_hWnd, WM_MY_MESSAGE, (WPARAM)(HWND)NULL, (LPARAM)&dd);
}
相关阅读 更多 +