| | |
GetKeyState syntax
![]() |
•
•
Join Date: Jan 2005
Posts: 23
Reputation:
Solved Threads: 0
At the beginning of an "IF" statement, I have:
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?
C Syntax (Toggle Plain Text)
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?
•
•
Join Date: Jan 2005
Posts: 23
Reputation:
Solved Threads: 0
Here is the MSDN entry for the function:
GetKeyState()
GetKeyState()
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,
C Syntax (Toggle Plain Text)
if (GetKeyState(48)==1){
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
>How can I take only the high order bit from that command?
Here's a slight push in the direction of a solution:
You can use it to test a certain bit by ANDing the result of bit(n) with the value:
Here's a slight push in the direction of a solution:
C Syntax (Toggle Plain Text)
#define bit(i) (1UL << (i))
C Syntax (Toggle Plain Text)
if ((GetKeyState(48) & bit(7)) != 0)
I'm here to prove you wrong.
![]() |
Similar Threads
- Parse error, syntax error, Forbids declaration (C++)
- Syntax for deleting specified file ( in C++) (C++)
- C++ Syntax (C++)
Other Threads in the C Forum
- Previous Thread: Dynamic Memory Allocation - offset pointers
- Next Thread: need help
| Thread Tools | Search this Thread |
#include * adobe ansi api array asterisks binarysearch centimeter changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc csyntax database directory dynamic execv feet fgets file fork function getlasterror getlogicaldrivestrin givemetehcodez global grade gtkgcurlcompiling gtkwinlinux hacking hardware highest histogram ide include incrementoperators infiniteloop input interest kernel keyboard kilometer license linked linkedlist linux linuxsegmentationfault list locate logical_drives looping loopinsideloop. lowest match matrix meter microsoft motherboard mqqueue number odf opendocumentformat opensource owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv repetition research reversing segmentationfault sequential single socket socketprograming standard string systemcall threads turboc unix user voidmain() wab whythiscodecausesegmentationfault windows.h windowsapi






