Problem mit GetKeyState

Hi
Ich habe ein Problem, bei dem ich gedacht habe, es mal eben lösen zu können.
Leider war das nicht der Fall :(

Also, hier mein Problem:

Ich möchte Prüfen, ob eine Taste gedrückt ist, oder nicht:
Code:
bool iskeydown(int key)
{
 if(HIWORD(GetKeyState(key)) == 1) return true;
 return false;
}

Sieht richtig aus, funktioniert aber nicht :(

dann hab ich die Funktion GetKeyState() mal getestet:
Code:
while( !HIWORD(GetKeyState(VK_LCONTROL)) );
Und festgestellt, das die Funktion überhaupt nicht funktioniert.. es wird IMMER 0 zurückgeliefert :(

Hab ich irgendwas Falsch gemacht??
Gibt es andere Möglichkeiten, festzustellen, ob eine Taste gedrückt ist, oder nicht??

Ich benutze DEV-CPP 4.9.8.0 unter win98
 
sorry :-<...

hab ich nicht gesehen:->.

Hier nochmal ein Link...
msdn zu Keydown

was passiert denn wenn du das ganze so machst:
Code:
 SHORT GetKeyState(int VK_LCONTROL);
 
aus der MSDN-Doku zu GetKeyState:
The key status returned from this function changes as a given thread reads key messages from its message queue. The status does not reflect the interrupt-level state associated with the hardware. Use the GetAsyncKeyState function to retrieve that information.

und zu GetAsyncKeyState:
If the function succeeds, the return value specifies whether the key was pressed since the last call to GetAsyncKeyState, and whether the key is currently up or down. If the most significant bit is set, the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState. The return value is zero if a window in another thread or process currently has the keyboard focus.
 
Zurück
Oben