πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Using GetAsyncKeyState() ?!!

#14344
From: Michel Corbin
Date: Sun, 17 Aug 2003 19:21
24 lines
1835 bytes
Schandler a οΏ½crit :
> 
> I want to use the api function GetAsyncKeyState (int vkey) to know if a
> specified key is down at the moment I'm calling the function
> the win32 api help says that the function detectes if the key is down if the
> "most significant bit is set" !! which I don't know what it means
> I tried to call the function to check if the Shift key is pressed on windows
> 98 as follows
> 
> int check key = GetAsyncKeyState(VK_SHIFT);
> but it didn't work correctly
> 
> does any one know about it ?

To know if a key is down at the moment you are calling the function,
I think it is better to write :
if(GetKeyState(VK_SHIFT)<0)
{
  ...
}
GetAsyncKeyState(VK_SHIFT<0) is true if the key has been down since
the last call of the function (That is what I've understood)

Michel
Technical Details
Message-ID: <3F3FD5D4.FF6CEAF@libertysurf.fr>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!skynet.be!skynet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f3f3635@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10cc67,64528418f36af68
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-17 12:40:18 PST
Message-ID: <3F3FD5D4.FF6CEAF@libertysurf.fr>
Date: Sun, 17 Aug 2003 21:21:57 +0200
From: Michel Corbin <corbin.michel@libertysurf.fr>
X-Mailer: Mozilla 4.7 [fr] (Win95; U)
X-Accept-Language: fr,en,es-ES,it,de-DE,pt
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Using GetAsyncKeyState() ?!!
References: <3f3f3635@newsgroups.borland.com>
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 212.47.231.174
X-Trace: newsgroups.borland.com 1061148156 212.47.231.174 (17 Aug 2003 12:22:36 -0700)
Lines: 24
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!skynet.be!skynet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail