F10 handler

I am inserting user-defined hotkeys in my application. I do it by handling WM_KEYDOWN and WM_SYSKEYDOWN in message loop. But. I got stupid problem - i cant handle F10 button. Where is  no  WM_KEYDOWN message when i pressing F10. Any ideas, how to dispatch this button ?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Override PreTranslateMessage for application class and check when pMsg->message == WM_KEYDOWN && pMsg->wParam = VK_F10
jabaAuthor Commented:
It working for all other keys, but F10. Look for messages, coming to window by Spy++. There are no any WM_KEYDOWN messages after you pressing F10. When you RELEASE this button, WM_SYSCOMMAND (SC_KEYMENU) WM_INITMENU etc appear. I need to dispatch F10 when it jast pressed.

Yes you are right. I checked with Spy, when I press F10 WM_SYSCOMMAND is sent to main window. First I don't understand why you cannot handle WM_SYSCOMMAND with F10. I also found that mwindow that has focus is sent two messages WM_SYSKEYDOWN and when you release F10 key WM_SYSKEYUP, so you can trap these messages for that window.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

Add the handler for WM_GETDLGCODE.
And write the below code to handler,


I hope it will be perfectly satisfying you.

jabaAuthor Commented:
HEh. Really. FOCUSED window getting WM_SYSKEYDOWN ! I trapping it in MAIN window of application. IS was my fault. Good answer. Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.