[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 921
  • Last Modified:

WM_KEYDOWN and the F10 key (non MFC app)

I need to catch function key presses in a windows application (c++ non mfc, NT4).

WM_KEYDOWN works fine for all the F keys apart from F10 becuase windows intercepts this key and sends a WM_SYSCOMMAND to activate the system menu on the window.

Is there any way I can prevent windows doing this so that I can handle the F10 key press myself in the same way I handle all the other function keys?
0
m26
Asked:
m26
1 Solution
 
nietodCommented:
The F10 keys sends a WM_SYSKEYDOWN instead of WM_KEYDOWN.  The purpose of this is to confuse you.  It seems to have worked.

Just handle this message.  If it is for the F10 key, treat it as you would like, don't pass it to the default window procedure.  The derfault window procedure will send a WM_SYSCOMMAND in response to WM_SYSKEYDOWN for the F10 key.
0
 
mikeblasCommented:
F10 sends WM_SYSKEYDOWN because it _is_ a system key; it sets keyboard focus to the menu, just like pressing and releasing ALT without pressing another key in combination.

Windows has worked this way since Version 1.0.  OS/2 works the same way.

..B ekiM
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now