2014/05/20

Dialog 기반 Application 에서 Accelerator 구현하기

// Header
class CMyDialog : public CDialogEx
{
:
HACCEL m_hAccel;
:
}

// Source
BOOL CMyDialog::OnInitDialog()
{
:
m_hAccel = LoadAccelerators(AfxGetInstanceHandle()
, MAKEINTRESOURCE(IDR_ACCELERATOR));
:
}

BOOL CMyDialog::PreTranslateMessage(MSG* pMsg)
{
:
if ( m_hAccel )
{
if (::TranslateAccelerator(m_hWnd, m_hAccel, pMsg))
{
return(TRUE);
}
}
:

return CDialogEx::PreTranslateMessage(pMsg);
}
<

Original Post : http://neodreamer-dev.tistory.com/726

No comments :

Post a Comment