Article ID: 117500
Article Last Modified on 11/21/2006
103788 Creating a Modeless Dialog Box with MFC Libraries
// .h file with your derived CDialog class.
class CModeless : public CDialog
{
.
public:
virtual BOOL PreTranslateMessage(MSG*);
.
};
//.cpp file.
BOOL CModeless::PreTranslateMessage(MSG* pMsg)
{
HACCEL hAccel =
((CMainFrame*)AfxGetApp()->m_pMainWnd)->GetAccelTable();
if(!(hAccel &&
::TranslateAccelerator(AfxGetApp()->m_pMainWnd->m_hWnd, hAccel,
pMsg)))
return CDialog::PreTranslateMessage(pMsg);
else
return TRUE;
}
// Mainfrm.h file, where CMainFrame is the main window class.
HACCEL CMainFrame::GetAccelTable() { return m_hAccelTable; }
Additional query words: kbinf 1.00 1.50 1.51 1.52 2.00 2.10 2.50 2.51 2.52 3.00 3.10 4.00
Keywords: kbinfo kbuidesign kbarchitecture kbkeyaccel kbdlg kbacceleratorkey KB117500