none
Detect CapsLock on/off RRS feed

Answers

  • You can do it following way..easy

    If My.Computer.Keyboard.CapsLock Then
                MessageBox.Show("Caps Lock On")
            Else
                MessageBox.Show("Caps Lock Off")
            End If


    Arjun Paudel
    • Proposed as answer by •.trujade.• Saturday, January 30, 2010 7:31 AM
    • Marked as answer by optimus_prime Saturday, January 30, 2010 10:12 AM
    Saturday, January 30, 2010 7:28 AM
  • Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
    
      Public Function CapsLockOn() As Boolean
        Dim iKeyState As Integer
        iKeyState = GetKeyState(Keys.CapsLock)
        CapsLockOn = (iKeyState = 1 Or iKeyState = -127)
      End Function
    
      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox(CapsLockOn)
      End Sub
    
     
    --------------------
    original code found here: http://www.freevbcode.com/ShowCode.asp?ID=78
    With . trujade. : . Process . Start ( " mns " ) : End With
    Saturday, January 30, 2010 5:53 AM

All replies

  • Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
    
      Public Function CapsLockOn() As Boolean
        Dim iKeyState As Integer
        iKeyState = GetKeyState(Keys.CapsLock)
        CapsLockOn = (iKeyState = 1 Or iKeyState = -127)
      End Function
    
      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox(CapsLockOn)
      End Sub
    
     
    --------------------
    original code found here: http://www.freevbcode.com/ShowCode.asp?ID=78
    With . trujade. : . Process . Start ( " mns " ) : End With
    Saturday, January 30, 2010 5:53 AM
  • You can do it following way..easy

    If My.Computer.Keyboard.CapsLock Then
                MessageBox.Show("Caps Lock On")
            Else
                MessageBox.Show("Caps Lock Off")
            End If


    Arjun Paudel
    • Proposed as answer by •.trujade.• Saturday, January 30, 2010 7:31 AM
    • Marked as answer by optimus_prime Saturday, January 30, 2010 10:12 AM
    Saturday, January 30, 2010 7:28 AM