1. 首先定義一個(gè)消息代碼
1 | #define WM_DEBUG WM_USER + 1999 |
2. 在窗口頭文件中添加
1 2 3 4 5 6 7 8 9 | class CStreamServerDlg : public CDialog{// Generated message map functions//{{AFX_MSG(CStreamServerDlg)...//}}AFX_MSGafx_msg void OnDebug(WPARAM wParam, LPARAM lParam);...} |
3. 在窗口的cpp文件中添加
1 2 3 4 5 6 | BEGIN_MESSAGE_MAP(CStreamServerDlg, CDialog)...ON_MESSAGE(WM_DEBUG, OnDebug)END_MESSAGE_MAP()void CStreamServerDlg::OnDebug(WPARAM wParam, LPARAM lParam){} |
4. 其他地方就可以發(fā)送消息
1 | pWnd->PostMessage(WM_DEBUG, (WPARAM)p, 0) ) |
聯(lián)系客服