At the beginning of an "IF" statement, I have:

if (SHORT GetKeyState(int 48)==1){

When compiling I get a syntax error just before the constant, and I've played around with it a bit, but haven't found what to do.

Could someone fix this or explain to me why it's not working?

Recommended Answers

All 5 Replies

Prototypes tell you the expected types, but when you call a function you don't include the type -- the type is inherently part of the variable or literal being used in the call. That is,

if (GetKeyState(48)==1){

I had realized that a bit after I posted, but I seem to be getting the low bit instead of the high bit, which is the one I need.

Isn't there a HIGH() operator or something?

How can I take only the high order bit from that command?

>How can I take only the high order bit from that command?
Here's a slight push in the direction of a solution:

#define bit(i) (1UL << (i))

You can use it to test a certain bit by ANDing the result of bit(n) with the value:

if ((GetKeyState(48) & bit(7)) != 0)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.