Bonjour,
Je viens de découvrir une autre façon de remplacer sendkeys avec la fonction SendMessage .
Par contre je ne sais pas comment saisir un texte au clavier, ni utiliser le CTRL+V, CRTL+C, ALT+TAB...
Existe t'il un site web répertoriant tous ces contrôles saisie clavier?
Voici la macro que j'utilise et son API:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 Private Declare Function GetKeyState Lib "user32" (ByVal iVirtualKey As Integer) As Long Private Declare Function GetDesktopWindow Lib "user32" () As Long Private Declare Function GetWindow& Lib "user32" (ByVal hwnd&, ByVal wCmd&) Private Declare Function GetWindowLong& Lib "user32" _ Alias "GetWindowLongA" (ByVal hwnd&, ByVal nIndex&) Private Declare Function GetWindowText& Lib "user32" Alias _ "GetWindowTextA" (ByVal hwnd&, ByVal lpString$, ByVal aint&) Private Const mconMAXLEN = 255 Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Private Const SW_MAXIMIZE = 3
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 Dim mick As String mick = "TEST" Dim res As Long Program = FindWindow(vbNullString, "without sampling") Dim setFocus As Long setFocus = SetForegroundWindow(Program) res = SendMessage(Program, LB_SETSEL, 0, -1)
Partager