|
-
May 28th, 2002, 06:05 AM
#1
NumLock Status
How can I set the NumLock status to ON in a C++ program?
Is there any System Call to do it?
Thanks.
-
May 28th, 2002, 06:56 AM
#2
This could help in VC
http://www.codeguru.com/misc/control...ock_keys.shtml
I also remember doing this using Assembly language in C via some keyboard interrrupt. Don't remember which interrupt is for keyboard.
Cheers
V
-
May 28th, 2002, 01:50 PM
#3
Re: NumLock Status
Originally posted by sarambur
How can I set the NumLock status to ON in a C++ program?
Is there any System Call to do it?
Thanks.
In standard C++, there is no function call to get the status of the numlock. You have to rely on what your operating system provides, and each operating system will use different methods.
Regards,
Paul McKenzie
-
May 29th, 2002, 03:59 AM
#4
Yeaa.. In C++ there is no function that allows you to set/get the status of NUMLOCK/CAPSLOCK key.
So whatever the OS is , in C++ you can set/get the status of these keys using BIOS calls.
You will have to find a function under Int 9 (Keyboard BIOS interrupt) which allows you to set/get values of these keys.
Cheers
V
-
May 29th, 2002, 08:24 AM
#5
Code:
int ReqdNumLockState = 0x0001;
if( (GetKeyState( VK_NUMLOCK ) & 0x0001) != ReqdNumLockState )
{
//Ponemos el NumLock a ON, para que se pueda escribir con el numpad directamente.
keybd_event( VK_NUMLOCK, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0 );
keybd_event( VK_NUMLOCK, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 );
}
finally I have used this piece of code.
I havent tested it yet, and I will post if it works or not in about 5 minutes (for anyone who wants to know, of course).
-
May 29th, 2002, 10:35 AM
#6
You also need to post what Windows OS this worked on. This forum is not a Windows-only forum.
Regards,
Paul McKenzie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|