CodeItBetter Programming Another VB Programming Blog

How to get the CapsLock state whether it is on or off

Posted on January 4, 2009
1
2
3
4
5
6
7
8
'System & API - How to get the CapsLock state whether it is on or off
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
 
Public Function CapsLockOn() As Boolean
    Dim iKeyState As Integer
    iKeyState = GetKeyState(vbKeyCapital)
    CapsLockOn = (iKeyState = 1 Or iKeyState = -127)
End Function
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.