How detect NumLock condition?

  • Thread starter Thread starter Woody Splawn
  • Start date Start date
W

Woody Splawn

Could someone tell me what code I run to determine if the user's numlock is
on?

Is there code I can run to set the numlock to on?
 
Hi,

Const VK_NUMLOCK = &H90

Declare Function GetKeyState Lib "user32" Alias "GetKeyState" (ByVal
nVirtKey As Integer) As Short

If GetKeyState(VK_NUMLOCK) Then

Me.Text = "Num"

Else

Me.Text = ""

End If

Ken
 
Hi Woody,

You may try to GetKeyState API to restrieve the state of Numlock and use
the keybd_event to set the state of NUM LOCK.

Here is a VB6 version.
HOWTO: Toggle the NUM LOCK, CAPS LOCK, and SCROLL LOCK Keys
http://support.microsoft.com/default.aspx?scid=kb;EN-US;177674

If you have any concern on this issue, please post here.


Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top