Postada em 04/01/2012 22:17 hs
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer Private Declare Sub keybd_event Lib "user32" (ByVal bVK As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Public Function GetSetKS(ByVal bolGetSetKS As Boolean, Optional ByVal intGetSetKSCapsLock As Integer = 0) As String
If bolGetSetKS = True Then GetSetKS = IIf(CBool(GetKeyState(vbKeyCapital) And 1) = True, 1, 0) Else Select Case intGetSetKSCapsLock Case 1 ' On If CBool(GetKeyState(vbKeyCapital) And 1) = False Then Call keybd_event(&H14, &H45, &H1 Or 0, 0) Call keybd_event(&H14, &H45, &H1 Or &H2, 0) End If Case 2 ' Off If CBool(GetKeyState(vbKeyCapital) And 1) = True Then Call keybd_event(&H14, &H45, &H1 Or 0, 0) Call keybd_event(&H14, &H45, &H1 Or &H2, 0) End If End Select DoEvents End If End Function
Private Sub cmdLiga_Click() GetSetKS False, 1 End Sub
Private Sub cmdDesliga_Click() GetSetKS False, 2 End Sub
|