VC下给CDialog添加加速键(Add accelerators)
为CDialog添加加速键:
//在头文件声明成员变量 HACCEL m_hAccelTable; //在构造函数中调用函数,加入加速键 CMyDlg::CMyDlg(CWnd* pParent /*=NULL*/) : CDialog(CMyDlg::IDD, pParent) { //{{AFX_DATA_INIT(CMyDlg) //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); //加速键 m_hAccelTable = ::LoadAccelerators(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_ACCELERATOR)); //加速键的资源ID }