R
Richard A. Lowe
I'm using P/Invoke to call SendInput (using code culled
from these newsgroups!) to send mouse events to a window.
But I'm unsure how to send double-clicks. A VB6 article I
saw on SendInput suggested simply queueing two click
events, but this is not working for me, regardless of the
delay I put between clicks. So give this as a click
(where INPUT is an appropriate structure for sending the
SendInput data):
public static void Click()
{
INPUT aInput = new INPUT();
aInput.type = INPUT_MOUSE;
aInput.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
aInput.mi.dwExtraInfo = 0;
aInput.mi.mouseData = 0;
aInput.mi.time = 0;
int aResult = SendInput(1, ref aInput, 28 );
INPUT bInput = new INPUT();
bInput.type = INPUT_MOUSE;
bInput.mi.dwFlags = MOUSEEVENTF_LEFTUP;
bInput.mi.dwExtraInfo = 0;
bInput.mi.mouseData = 0;
bInput.mi.time = 0;
int bResult = SendInput(1, ref bInput, 28 );
}
The call:
Click();
Thread.Sleep(50);
Click();
Does not work no double-click is produced no matter if the
delay is 0, 50, 100 etc. How can I send a double-click?
TIA
Richard
from these newsgroups!) to send mouse events to a window.
But I'm unsure how to send double-clicks. A VB6 article I
saw on SendInput suggested simply queueing two click
events, but this is not working for me, regardless of the
delay I put between clicks. So give this as a click
(where INPUT is an appropriate structure for sending the
SendInput data):
public static void Click()
{
INPUT aInput = new INPUT();
aInput.type = INPUT_MOUSE;
aInput.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
aInput.mi.dwExtraInfo = 0;
aInput.mi.mouseData = 0;
aInput.mi.time = 0;
int aResult = SendInput(1, ref aInput, 28 );
INPUT bInput = new INPUT();
bInput.type = INPUT_MOUSE;
bInput.mi.dwFlags = MOUSEEVENTF_LEFTUP;
bInput.mi.dwExtraInfo = 0;
bInput.mi.mouseData = 0;
bInput.mi.time = 0;
int bResult = SendInput(1, ref bInput, 28 );
}
The call:
Click();
Thread.Sleep(50);
Click();
Does not work no double-click is produced no matter if the
delay is 0, 50, 100 etc. How can I send a double-click?
TIA
Richard