首页 > 焦点 > 在VC中添加响应自定义的消息的代码步骤
在VC中添加响应自定义的消息的代码步骤
网上收集 2007/11/27 9:04:30 (87)
  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()

void CStreamServerDlg::OnDebug(WPARAM wParam, LPARAM lParam)
{}

  4. 其他地方就可以发送消息

pWnd->PostMessage(WM_DEBUG, (WPARAM)p, 0) )

阅读(87) (责任编辑:城市网)
关于我们 - 联系我们 - 网站荣誉 - 广告服务 - 版权声明 - 网站地图
Copyright© 2007-2018 bj1.com.cn 首都热线 版权所有 QQ:165687462
中国·北京 粤ICP备14047004号-20