How to use F10 as a shortcut in an MFC application using tape

I developed the MFC application using VS2008 and the MFC functional package. This application user interface uses ribbon.

Now I need to have F10 as a suitable shortcut for one of the most important functions of my application, but I seem to be unable to install the accelerator correctly, since it always uses the default ribbon accelerator in my opinion.

Any idea how to achieve this?

+3
source share
3 answers

, . - SetWindowsHookEx . , Vista/Win7/Server 2008 . - DLL.

0

WM_SYSKEYDOWN wParam VK_F10? F10 , Alt, .

0

, : BOOL PreTranslateMessage (MSG * pMsg);

BOOL CMyView::PreTranslateMessage(MSG* pMsg)
{
    if ((pMsg->message == WM_SYSKEYDOWN) && (pMsg->wParam == VK_F10))
    {
        OnMyAction(); //code on F10
        return TRUE;
    }
    return CView::PreTranslateMessage(pMsg);
}
0
source

Source: https://habr.com/ru/post/1752962/


All Articles