[DllImport("user32")] private static extern void SendMessage( IntPtr hwnd, int msg, int wparam, int lparam ); private const int WM_LBUTTONDOWN = 0x0201; private const int WM_LBUTTONUP = 0x0202; private const int MK_LBUTTON = 0x0001;
SendMessage(button.Handle, WM_LBUTTONDOWN, MK_LBUTTON, 0); // bouton gauche enfoncé Application.DoEvents(); System.Threading.Thread.Sleep(100); // une petite pause de 100ms SendMessage(button.Handle, WM_LBUTTONUP, 0, 0); // bouton gauche relaché
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question