SendKeys "{INSERT}"
Private Type KeyboardBytes kbByte(0 To 255) As Byte End Type Const VK_INSERT = &H2D Dim kbArray As KeyboardBytes Private Declare Function GetKeyboardState Lib "user32" (kbArray As KeyboardBytes) As Long Private Declare Function SetKeyboardState Lib "user32" (kbArray As KeyboardBytes) As Long Private Sub Command1_Click() TurnOn (VK_INSERT) End Sub Private Sub Command2_Click() TurnOff (VK_INSERT) End Sub Private Sub TurnOn(vkKey As Long) 'Get the keyboard state GetKeyboardState kbArray 'Change a key kbArray.kbByte(vkKey) = 1 'Set the keyboard state SetKeyboardState kbArray End Sub Private Sub TurnOff(vkKey As Long) 'Get the keyboard state GetKeyboardState kbArray 'change a key kbArray.kbByte(vkKey) = 0 'set the keyboard state SetKeyboardState kbArray End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionConst VK_INSERT As Byte = &H2D Const KEYEVENTF_EXTENDEDKEY = &H1 Const KEYEVENTF_KEYUP = &H2 Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwflags As Long, ByVal dwExtraInfo As Long) AppActivate ("touche inser activée?") 'Simule Key Press keybd_event VK_INSERT, 0, 0, 0 'Simule Key Release keybd_event VK_INSERT, 0, KEYEVENTF_KEYUP, 0