Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Statue
19
Years of Service
User Offline
Joined: 16th Nov 2006
Location: Monterey Hills, CA
Posted: 13th Apr 2012 20:37
Hello Ya'all:

Is there a way in DBP to tell if num lock is on or off?

Lance
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Apr 2012 23:44 Edited at: 13th Apr 2012 23:57
Yes, using the GET KEY STATE function:


The values are:
0 - off
1 - on
-127 - being switched on
-128 - being switched off

... or if you are familiar with binary:
bit 0 - the on/off bit
bit 7 - the key down bit (1 if currently down)

[edit]It occurred to me that it may be helpful to also post a link to a list of the keycodes: http://msdn.microsoft.com/en-us/library/ms927178.aspx

The list contains hex values, but if you prefix them with '0x' as I have in the short piece of code I posted, then you can use them directly.

Statue
19
Years of Service
User Offline
Joined: 16th Nov 2006
Location: Monterey Hills, CA
Posted: 14th Apr 2012 00:14
Thanks IanM - you are awesome...

Login to post a reply

Server time is: 2026-07-09 02:12:43
Your offset time is: 2026-07-09 02:12:43