st
asked on
Small script to enable the Num Lock key
How to use a small QB/VB script to enable the Num Lock key?
(Preferer use QB command if you know.)
Thanks.
(Preferer use QB command if you know.)
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Functin GetCapslock() As Boolean
' ' Return or set the Capslock toggle.
GetCapslock = CBool(GetKeyState(vbKeyCap
End Function
Fuction GetNumlock() As Boolean
' ' Return or set the Numlock toggle.
GetNumlock = CBool(GetKeyState(vbKeyNum
End Function
Function GetScrollLock() As Boolean
' ' Return or set the ScrollLock toggle.
GetScrollLock = CBool(GetKeyState(vbKeyScr
End Function
Sub SetCapslock(Value As Boolean)
' ' Return or set the Capslock toggle.
Call SetKeyState(vbKeyCapital, Value)
End Sub
Sub SetNumlock(Value As Boolean)
' ' Return or set the Numlock toggle.
Call SetKeyState(vbKeyNumlock, Value)
End Sub
Set SetScrollLock(Value As Boolean)
' ' Return or set the ScrollLock toggle.
Call SetKeyState(vbKeyScrollLoc
End Sub
Private Sub SetKeyState(intKey As Integer, fTurnOn As Boolean)
' ' Retrieve the keyboard state, set the particular
' ' key in which you're interested, and then set
' ' the entire keyboard state back the way it
' ' was, with the one key altered.
Dim abytBuffer(0 To 255) As Byte
GetKeyboardState abytBuffer(0)
abytBuffer(intKey) = CByte(Abs(fTurnOn))
SetKeyboardState abytBuffer(0)
End Sub