Recimo:
http://tinyurl.com/3b7ct9
--- H ---
Code:
private:
bool Key81Pressed;
bool Key87Pressed;
bool Key69Pressed;
--- CPP ---
Code:
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Key81Pressed = false;
Key87Pressed = false;
Key69Pressed = false;
}
void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
// 81=Q, 87=W, 69=E
if ( !Key81Pressed && Key == 81 )
Key81Pressed = true;
if ( !Key87Pressed && Key == 87 )
Key87Pressed = true;
if ( !Key69Pressed && Key == 69 )
Key69Pressed = true;
if ( Key81Pressed && Key87Pressed && Key69Pressed )
{
Key81Pressed = false;
Key87Pressed = false;
Key69Pressed = false;
ShowMessage( "Q W E Pressed" );
}
}
void __fastcall TForm1::FormKeyUp(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if ( Key == 81 ) Key81Pressed = false;
if ( Key == 87 ) Key87Pressed = false;
if ( Key == 69 ) Key69Pressed = false;
}
...ili pogledaj GetKeyboardState() API, ako ti ovo ne odgovara.
P.S.
Ili, gde god imaš u izrazima konstante tipa:
if ( Key == 81 ) Key81Pressed = false;
... zameni sa odgovarajućim velikim slovom zbog čitljivosti, na primer:
if ( Key == 'Q' ) Key81Pressed = false;
itd...
81 ---> 'Q'
87 ---> 'W'
69 ---> 'E'
[Ovu poruku je menjao X Files dana 03.03.2008. u 07:45 GMT+1]