Home > Software engineering >  Accelerate key table problem, I am a novice, the great god give advice or comments, please
Accelerate key table problem, I am a novice, the great god give advice or comments, please

Time:09-28

I press the book says, in PreCreateWindow () calls the LoadAccelerators (),

And then reload the CWnd TranslateMessage ()

As follows:
Bool CwindowingClass: : PreTranslateMessage (MSG * pMsg)
{
If (g_hAccel==NULL)
return FALSE;
Return: : PreTranslateAccelerator (m_hWnd, g_hAccel, pMsg);//that out of the question, a great god taught!
}


CodePudding user response:

TranslateAccelerator

BOOL CPickChar: : PreTranslateMessage (MSG * pMsg)
{
//TODO: Add your specialized code here and/or call the base class
If (pMsg - & gt; The message & gt;=WM_KEYFIRST & amp; & PMsg - & gt; The message & lt;=WM_KEYLAST)
{//Translate the message using accelerator table
ASSERT (m_hAccel);
Return: : TranslateAccelerator (m_hWnd, m_hAccel, pMsg);
}
//
Return CDialog: : PreTranslateMessage (pMsg);
}

CodePudding user response:

CodePudding user response:

Standard MFC procedures, are generally carried out overloading App ProcessMessageFilter,

BOOL CTracerApp: : ProcessMessageFilter (int code, LPMSG LPMSG)
{
If (code & gt;=0 & amp; & GhDlg & amp; & GhAccelTable)
{
If (: : TranslateAccelerator (ghDlg ghAccelTable, lpMsg))
Return (TRUE);
}

Return CWinApp: : ProcessMessageFilter (code, lpMsg);
}

CodePudding user response:

Thank you

CodePudding user response:

I'm going to learn to Windows programming, first in the province of the old
  • Related