🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Using GetAsyncKeyState() ?!!

#14342
From: Dennis Jones
Date: Sun, 17 Aug 2003 18:41
23 lines
1820 bytes
"Chris Hill" <Chris244@aol.com> wrote in message
news:3f3f5610.3143789530@forums.borland.com...
> On Sun, 17 Aug 2003 11:08:23 +0300, "Schandler"
> <theslider@programmer.net> wrote:
>
> >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
>
> Try this:
> int keydown = (GetAsyncKeyState(VK_SHIFT) < 0);

Or, more explicitly, check the most significant bit:

bool keydown = ((GetAsyncKeyState(VK_SHIFT) & 0x8000) == 0x8000);

- Dennis
Technical Details
Message-ID: <3f3fcc6b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newsfeed.news2me.com!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3f3f3635@newsgroups.borland.com> <3f3f5610.3143789530@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,64528418f36af68
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-17 11:53:14 PST
From: "Dennis Jones" <djones@nospam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f3f3635@newsgroups.borland.com> <3f3f5610.3143789530@forums.borland.com>
Subject: Re: Using GetAsyncKeyState() ?!!
Date: Sun, 17 Aug 2003 11:41:47 -0700
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 204.200.27.7
Message-ID: <3f3fcc6b$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1061145707 204.200.27.7 (17 Aug 2003 11:41:47 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newsfeed.news2me.com!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail