VC 对话框中注册热键

对话框中注册热键
1.
对话框OnInitDialog()函数中加入:
               ::RegisterHotKey(m_hWnd,199,MOD_CONTROL,'Z');

2.
BEGIN_MESSAGE_MAP(CTestDlg, CDialog)
               //{{AFX_MSG_MAP(CTestDlg)
               ON_MESSAGE(WM_HOTKEY,OnHotKey)                //
添加

               //}}AFX_MSG_MAP
END_MESSAGE_MAP()

3.添加成员函数:
void OnHotKey(WPARAM wp, LPARAM lp){
               if(wp==199)
               {
                             AfxMessageBox("Ctrl+Z");
               }
}

posted on 2007-04-20 16:04  路吾  阅读(800)  评论(0编辑  收藏  举报

导航