Num lock on
Moderators:Administrator, Global Moderator
-
- Full Member
- Posts:36
- Joined:Tue Mar 18, 2003 3:04 am
- Location:Lancashire, UK
- Contact:
Hi
Is there a way to ensure that the num lock key effectively stays on throughout a program, even if accidentally pressed? Sort of along the lines of "If num lock turned off, num lock turned on again".
I have a small program which records a sequence of numbers, some of which may have to be typed quickly, and it is all too easy to accidentally catch the num lock key which would then prevent further number entry via the numeric keypad until the problem was spotted.
The program executes a section of code every second using the On Timer function (as it runs a clock as well) so it's possible that the checking routine could be there.
This would have to also work when the program is compiled for distribution to any pc user, including those who may be running XP, as I want to circulate compiled copies once I've finished development, rather than the quickbasic source code..
Any ideas chaps?
The only thought I've come up with so far is to drill a hole in the key and put a pin through it once num lock is set!
Is there a way to ensure that the num lock key effectively stays on throughout a program, even if accidentally pressed? Sort of along the lines of "If num lock turned off, num lock turned on again".
I have a small program which records a sequence of numbers, some of which may have to be typed quickly, and it is all too easy to accidentally catch the num lock key which would then prevent further number entry via the numeric keypad until the problem was spotted.
The program executes a section of code every second using the On Timer function (as it runs a clock as well) so it's possible that the checking routine could be there.
This would have to also work when the program is compiled for distribution to any pc user, including those who may be running XP, as I want to circulate compiled copies once I've finished development, rather than the quickbasic source code..
Any ideas chaps?
The only thought I've come up with so far is to drill a hole in the key and put a pin through it once num lock is set!
-
- Full Member
- Posts:36
- Joined:Tue Mar 18, 2003 3:04 am
- Location:Lancashire, UK
- Contact:
Numlock coding
The following code checks if the Numlock bit in the Keyboard Data Byte is ON and if not turns it ON. It has been tested in Windows 98se QBasic 4.5 IDE. It has not been compiled & run nor has it been tested in Win.XP.
Good luck with your projects.
V...
Code: Select all
DEF SEG = 0
inbyte = PEEK(&H417) ' Put the byte at &H417 into variable inbyte
IF (inbyte AND 32) THEN ' Check if the Num-lock bit is ON
ELSE POKE &H417, PEEK(&H417) OR 32 ' Set Num-lock bit ON
END IF
DEF SEG
V...
-
- Full Member
- Posts:36
- Joined:Tue Mar 18, 2003 3:04 am
- Location:Lancashire, UK
- Contact:
Yes, agree
Thanks for coming back - lots of posters don't.
Agree that there may be a problem with XP, it has the nasty habit of "hiding" things from non-MS programmers. Sorry, I don't run XP so can't help you with it, I'm strictly not an NT fan..
Cheers again
V...
Agree that there may be a problem with XP, it has the nasty habit of "hiding" things from non-MS programmers. Sorry, I don't run XP so can't help you with it, I'm strictly not an NT fan..
Cheers again
V...
-
- Full Member
- Posts:36
- Joined:Tue Mar 18, 2003 3:04 am
- Location:Lancashire, UK
- Contact:
Manners
Just good manners that's all! Obliged for any assistance.
best wishes
John
best wishes
John