- GetakeyState Problem
- Posted by Basim Kakakhail on July 18th, 2003
hi all im trying to use GetKeyState function to know that whether an
ALT or Control key is doen or not , the function returns a value of
type SHORT, but i have a confusion as in the documentation it is
wriitem that
"If the high-order bit is 1, the key is down; otherwise, it is up. "
now the question is that what is this high order bit and how would i
extract this .
thanx
Basim
- Posted by Dave C. on July 18th, 2003
On 18 Jul 2003, Basim Kakakhail wrote:
The return value will be negative if the key is down. So
altIsDown := GetKeyState(VK_MENU) < 0;
would test if alt is held down where altIsDown is a boolean. Also, I
believe GetASyncKeyState (or some such similar name) give a more immediate
reflection of the keyboard state which may be of interest to you (see
win32 docs). Short is just a 8 or 16 bit signed integer (I can't remember,
caffeine's not working, should go back to bed) so any bitwise ops would
work on it, and the high order bit determintes the sign of the integer
(i.e. positive or negative).
Translate the above code from object pascal to your language of choice,
:= is pascal's assignment operator, like c's =.
Dave
- System Restore Tab still has access problem (multi-disk problem?) srrstr.dll error (Performance/Maintainence) by Dallas Overturf
- Problems With Adaptec 2400a RAID Card. (rare problem ? ? ? or Common Problem...? ? ?) (Computer Hardware) by Starz_Kid
- installed SP2, now get Quick Launch problem and Programs menu problem (Customizing) by Sentinel
- Unable to move desktop icons, mouse problem, DVD burner problem. (Microsoft Windows) by Klevmore
- Problem with Security Certificates also Windows Update software problem (Computers & Technology) by Happy@Camper.Com

