views:

41

answers:

2

Hello,

I developed an MFC application using VS2008 and the MFC featurepack. This application UI is using a ribbon.

I now need to have F10 as a proper shortcut for one of the critical feature of my application but I seem to be unable to set the accelerator correctly as it always use the default ribbon accelerator over mine.

Any idea how to achieve this ?

A: 

I assume you've already tried registering a hotkey. The canonical way to get at the keystroke is to use SetWindowsHookEx, for your app's main thread. Global windows hooks are loady, and the security restriction on hooking in Vista/Win7/Server 2008 have made them a lot less useful anyway. But a process-specific hook would be fine - and wouldn't need to be in a DLL.

Bob Moore
A: 

Have you tried adding a handler for WM_SYSKEYDOWN and checking the message code for a wParam value of VK_F10? F10 needs special handling as it's the old alternative for pressing the Alt key to open the menu bar under keyboard control.

DavidK