Does anybody know of a way to capture multiple keys
being pressed at once?
Bogdan.
--- *.H ---
private: // User declarations
bool Key81Pressed;
bool Key87Pressed;
bool Key69Pressed;
--- *.CPP ---
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Key81Pressed = false;
Key87Pressed = false;
Key69Pressed = false;
}
void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
// How can I get this by some func like ord('...') ?
// 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;
}
--
Best regards,
Vladimir Stefanovic
Bogdan <bop...@xnet.ro> wrote in message
news:415f...@newsgroups.borland.com...
Look at GetKeyboardState() in the Windows API.
Regards,
Bruce