deklarace
Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Const VK_CAPITAL = &H14
Public Const KEYEVENTF_KEYUP = &H2
Public Const KEYEVENTF_EXTENDEDKEY = &H1
tlačítko Command1
Private Sub Command1_Click()
'zapnutí
If GetKeyState(VK_CAPITAL) = 0 Then
keybd_event VK_CAPITAL, 0, 0, 0
keybd_event VK_CAPITAL, 0, KEYEVENTF_EXTENDEDKEY, 0
End If
'vypnutí
If GetKeyState(VK_CAPITAL) <> 0 Then
keybd_event VK_CAPITAL, 0, 0, 0
keybd_event VK_CAPITAL, 0, KEYEVENTF_KEYUP, 0
End If
End Sub
|