Article View: borland.public.cppbuilder.nativeapi
Article #17447Re: How to get and set the NumLock State?
From: Rodolfo Frino - Stargate Softwar...
Date: Mon, 24 Mar 2003 23:45
Date: Mon, 24 Mar 2003 23:45
29 lines
1493 bytes
1493 bytes
Two more functions
// Detect Key
bool NumberLockPressed()
{
SHORT result = GetAsyncKeyState(VK_NUMLOCK);
if ((result & 0x8000) == 0x8000)
return true; //pressed
else
return false;
}
// Get the state of the key
unsigned char GetNumLockState()
{
// RETURN VALUE:
// 0 NUMLOCK KEY OFF
// 1 NUMLOCK KEY ON
unsigned char keyState[256];
// Copy the status of the 256 virtual keys to
// the specified buffer.
GetKeyboardState((LPBYTE)&keyState);
return keyState[VK_NUMLOCK] & 1;
}
Rodolfo
Technical Details
Message-ID:
<3e7fa189$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3e7e4050@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,6e8150c928fb21c9 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-03-24 16:28:00 PST From: "Rodolfo Frino - Stargate Software" <starcinema@eftel.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3e7e4050@newsgroups.borland.com> Subject: Re: How to get and set the NumLock State? Date: Tue, 25 Mar 2003 10:45:27 +1100 Lines: 31 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 203.129.132.93 Message-ID: <3e7fa189$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1048551817 203.129.132.93 (24 Mar 2003 16:23:37 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail