Sorry for the delay in replying, I was involved in yet another move
over the last week!  In any case, thanx to your explanations I've got it
now.  It seems odd that there aren't any functions declared which provide
the particular high-order bit info wanted directly so that you wouldn't have
to mask the return.  I'm not missing them somewhere am I?
        
from Robert Meek dba Tangentals Design  CCopyright 2006
Proud to be a moderator of "The Delphi Lists" at elists.org

"When I examine myself and my methods of thought, I come to the conclusion
that the gift of Fantasy has meant more to me then my talent for absorbing
positive knowledge!"
                                                    Albert Einstein


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Rob Kennedy
Sent: Friday, April 28, 2006 1:34 AM
To: Borland's Delphi Discussion List
Subject: Re: Virtual key codes

Robert Meek wrote:
> I also wasn't aware
> that Delphi doesn't support binary!  Is that true only for numerics?

No. Delphi only supports decimal and hexadecimal. No binary, and no octal.

> Now you said that GetKeyState could return any bit...meaning what in
> actual practice...that I shouldn't rely on the return as given and that I
> should mask it as well?

I think I explained what you should do in my previous message, in the 
section where I talk about what $8000 means and how it works.

> The help says it returns the high order bit

Not quite. It returns a value in the high-order bit.

> so doesn't that mean the function is doing that for me?   

The function returns the high-order bit, but it *also* returns the other 
15 bits. It's impossible to return just one bit. GetKeyState's return 
type is Word. That's a 16-bit type, and it *always* holds 16-bit values.

You're getting 16 bits from the function whether you want them or not, 
but you've only been told the meanings of two of them, you'd better make 
sure you don't let any of the other 14 interfere with your program.

In your old code, you compared the return value against zero. You were 
effectively asking whether *any* of the bits were set; any set bit 
forces the value to be nonzero.

-- 
Rob
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to