Solved

GetAsyncKeyState and toAscii

Posted on 2009-05-14
3
592 Views
Last Modified: 2013-12-03
Hi,

I'm wondering if it is possible to use GetAsyncKeyState and then translate it from a virtual key code to an ascii character as GetAsyncKeyState cannot easily differentiate between upper and lower case? If so, would somebody be kind enough to point me to an example?

Thank you,
Uni
0
Comment
Question by:Unimatrix_001
3 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 250 total points
ID: 24386173
Hi Unimatrix_001,

since GetAsyncKeyState only returns state for a single key the only way to do this is to test if any of the SHIFT key's state is 'pressed' too. Further maybe even you'd have to test if ALT/ALTGR is pressed to in order to identify special characters.

Unfortunately I don't know if you can use GetAsyncKeyState even to find out if CAPS_LOCK is on, so you'll have to test it. If it's not possible I think the only way to find out if it's a upper- or lower-case you have to use GetKeyboardState ...

ZOPPO
0
 
LVL 86

Assisted Solution

by:jkr
jkr earned 250 total points
ID: 24386264
You could use 'GetKeyNameText()' (http://msdn.microsoft.com/en-us/library/ms646300.aspx) or 'MapVirtualKey()' (http://msdn.microsoft.com/en-us/library/ms646306.aspx) for that, depending on what you need.
0
 
LVL 3

Author Closing Comment

by:Unimatrix_001
ID: 31581504
Thank you. :)
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question