🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #8645

Re: Capture multiple keys.

#8645
From: Vladimir Stefanovic
Date: Sun, 03 Oct 2004 16:18
72 lines
2328 bytes
Maybe something like this / Untested ! /, so some changes
may possibly be necessary:

--- *.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 <boprea@xnet.ro> wrote in message
news:415fc828@newsgroups.borland.com...
> Hello
>
>   Does anybody know of a way to capture multiple keys
> being pressed at once?
>
> Bogdan.
>
>
Technical Details
Message-ID: <4160260d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <415fc828@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,34e2ea0c9d2fe445
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Vladimir Stefanovic" <spam@not.needed>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <415fc828@newsgroups.borland.com>
Subject: Re: Capture multiple keys.
Date: Sun, 3 Oct 2004 18:18:26 +0200
Lines: 74
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
NNTP-Posting-Host: 213.137.116.129
Message-ID: <4160260d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1096820237 213.137.116.129 (3 Oct 2004 09:17:17 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail