Solved

GetAsyncKeyState and toAscii

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

762 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