VC下给CDialog添加加速键(Add accelerators)
为CDialog添加加速键:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
//在头文件声明成员变量 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 } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
//添加PreTranslateMessage消息相应 BOOL CMyDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class //加速键事件 if(m_hAccelTable != NULL) { if(TranslateAccelerator(m_hWnd, m_hAccelTable, pMsg)) { return TRUE; } } return CDialog::PreTranslateMessage(pMsg); } |
Trackback from your site.
(8)条评论
innovative Learning solutions
| #
innovative Learning solutions
Wupei's Blog » VC下给CDialog添加加速键(Add accelerators)
回复
United Ceres Singapore
| #
United Ceres Singapore
Wupei's Blog » VC下给CDialog添加加速键(Add accelerators)
回复
Harga Scrub station
| #
Harga Scrub station
Wupei's Blog » VC下给CDialog添加加速键(Add accelerators)
回复
visit the following website
| #
visit the following website
Wupei's Blog » VC下给CDialog添加加速键(Add accelerators)
回复
Wheels & Tires Html Templates
| #
Wheels & Tires Html Templates
Wupei's Blog » VC下给CDialog添加加速键(Add accelerators)
回复
債務重組邊間好
| #
債務重組邊間好
Wupei's Blog » VC下给CDialog添加加速键(Add accelerators)
回复
ua債務重組債務重組 邊間好
| #
ua債務重組債務重組 邊間好
Wupei's Blog » VC下给CDialog添加加速键(Add accelerators)
回复
VC 筱强
| #
不错
回复