Try this.
Code:Option Explicit Private Type KeyboardBytes kbByte(0 To 255) As Byte End Type Private Declare Function GetKeyboardState Lib "user32" (kbArray As KeyboardBytes) As Long Private Const VK_CAPITAL = &H14 Private Const VK_NUMLOCK = &H90 Private Const VK_SCROLL = &H91 Private Sub Text1_GotFocus() Dim KeyboardBuffer As KeyboardBytes GetKeyboardState KeyboardBuffer If KeyboardBuffer.kbByte(VK_CAPITAL) = 0 Then MsgBox "Caps off" Else MsgBox "Caps on" End If End Sub




Reply With Quote