Access Numlock Using VB

     Access the numlock using the Vb program.

Added Control:

1)3 command button.

At the Declaration,type in:

Private Declare Function GetKeyState Lib "user32" ( _

 

ByVal nVirtKey As Long) As Integer

At the form,type in the following code:

Private Sub Command1_Click()

 

If GetKeyState(vbKeyNumlock) = 1 Then

MsgBox "Num Lock is On"

Else

MsgBox "Num Lock is Off"

End If

End Sub

Private Sub Command2_Click()

If GetKeyState(vbKeyScrollLock) = 1 Then

MsgBox "Scroll Lock is On"

Else

MsgBox "Scroll Lock is Off"

End If

End Sub

Private Sub Command3_Click()

If GetKeyState(vbkeyCAPSLOCK) = 1 Then

MsgBox "Num Lock is On"

Else

MsgBox "Num Lock is Off"

End If

End Sub


Notes:The Submitter will not bear any responsible for any misused,unfuntionality.The code is use for NON-Commercial only.

                                                                                

                                         The Site is created by VB Home