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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Typing the colon or semicolon in the program 1

Status
Not open for further replies.

ty1122

Programmer
Jan 20, 2005
16
US
hi,

I was trying to type in some keycodes with "keybd_event" API. It works for most keys on the keyboard but i can't find any keycodeconstants for ":" or ";" the ascii values are 59 and 58. But when i use keybd_event 58,1,0,0 nothing happens but other values are fine. I wonder if there is any other way to do the same thing as this API.

Thank you,
Ty1122
 
The keycodes used by keybd_event are nothing to do with the ASCII values of the keys; it uses virtual keycodes (the 26 letters of the English alphabet just happen to have virtual keycodes that match their ASCII values; not quite coincidence, but not to be extrapolated to other keyboard characters)

The virtual keycode for both ; and : is (typically)

VK_OEM_1 = &HBA

You can convert a known ASCII value to its correct virtual keycode on a particular PC by using the VkKeyScan API call

 
Thank you for solving my program.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top