Solved

GetAsyncKeyState and toAscii

Posted on 2009-05-14
3
595 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…

737 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