Posted on 2006-07-02 18:00
will 閱讀(261)
評論(0) 編輯 收藏 引用 所屬分類:
技術探索
1. 首先定義一個消息代碼
#define WM_DEBUG???? WM_USER + 1999
2. 在窗口頭文件中添加
class CStreamServerDlg : public CDialog
{
?// Generated message map functions
?//{{AFX_MSG(CStreamServerDlg)
...
?//}}AFX_MSG
?afx_msg void OnDebug(WPARAM wParam, LPARAM lParam);?
...
}
3. 在窗口的cpp文件中添加
BEGIN_MESSAGE_MAP(CStreamServerDlg, CDialog)
...
?ON_MESSAGE(WM_DEBUG, OnDebug)
END_MESSAGE_MAP()
LRESULT? CStreamServerDlg::OnDebug(WPARAM wParam, LPARAM lParam)
{
}
4. 其他地方就可以發送消息
pWnd->PostMessage(WM_DEBUG,? (WPARAM)p, 0) )
說明:
#define ON_MESSAGE(message, memberFxn)
{ message, 0, 0, 0, AfxSig_lwl,
(AFX_PMSG)(AFX_PMSGW)(LRESULT (AFX_MSG_CALL CWnd::*)(WPARAM, LPARAM))&memberFxn },