Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Function Keys F1-F12 in a window 2

Status
Not open for further replies.

DrychronRed

Programmer
Sep 15, 2002
4
US
Hi everyone, and thanks ahead of time for considering my post. :)

I need to trap function key F1-F12 keystrokes in a window. I have tried OnChar() and OnKeyDown() etc. which give me regular keys, and I have tried OnSysChar() which gives me ALT-keys, but I am still lost as to how to get the function keys. I'm sure there's a way, but I have searched and can't find it. Also, someone once (many years ago when I didn't need this) told me you could trap the function keys, but not F1 because F1 was trapped ahead of time by the system for HELP, and you would have to somehow get at it with a system call.

Any help would be greatly appreciated! I don't even need code, just what function or method to research!
Cheers,

Drychron Red
 
some functions that may do whatyou want.
RegisterHotKey

GetAsyncKeyState
The GetAsyncKeyState function determines whether a key is up or down at the time the function is called, and whether the key was pressed after a previous call to GetAsyncKeyState

Key Status
While processing a keyboard message, an application may need to determine the status of another key besides the one that generated the current message. For example, a word-processing application that allows the user to press shift+end to select a block of text must check the status of the shift key whenever it receives a keystroke message from the end key. The application can use the GetKeyState function to determine the status of a virtual key at the time the current message was generated; it can use the GetAsyncKeyState function to retrieve the current status of a virtual key.

The keyboard layout maintains a list of names. The name of a key that produces a single character is the same as the character produced by the key. The name of a noncharacter key such as tab and enter is stored as a character string. An application can retrieve the name of any key from the device driver by calling the GetKeyNameText function.

Download HOTKEYED.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:

Microsoft Download Service (MSDL)

Dial (206) 936-6735 to connect to MSDL
Download HOTKEYED.EXE (size: 25821 bytes)

Attitude is Everything
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top