VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

CapsLock and NumLock

Ian Ippolito (vWorker)  (14 Submissions)   Windows System Services   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

How to Activate CapsLock and NumLock from Code

Assumes
The keyboard APIs for VB4-16 and VB3 do not support the byte data type. By changing the Windows constant to Public Const VK_NUMLOCK = &H90, you can use the above to activate the NumLock key.

API Declarations
Public Const VK_CAPITAL = &H14
Public Type KeyboardBytes
     kbByte(0 To 255) As Byte
End Type
Public kbArray As KeyboardBytes
Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Long
Public Declare Function GetKeyboardState Lib "user32" (kbArray As KeyboardBytes) As Long
Public Declare Function SetKeyboardState Lib "user32" (kbArray As KeyboardBytes) As Long

Rate CapsLock and NumLock (5(5 Vote))
CapsLock and NumLock.bas

CapsLock and NumLock Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters