Solved

GetAsyncKeyState and toAscii

Posted on 2009-05-14
3
589 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 30

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now