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 6 15600
Could you tell me the idea behind simulating double click
Kalpesh
"Richard A. Lowe" <ch*****@yumspamyumYahoo.com> wrote in message
news:0e****************************@phx.gbl... 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
I want to control a 'legacy' GUI that you must dbl-click
on in certain forms. This GUI will run on an undisturbed
server and has tolerance for failure. But it needs the
double-click event at certain points.
Richard -----Original Message----- Could you tell me the idea behind simulating double click
Kalpesh
"Richard A. Lowe" <ch*****@yumspamyumYahoo.com> wrote in
messagenews:0e****************************@phx.gbl... 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
.
Are you sure the structure is right? Can you post a copy of your
definition of the structure?
Jonathan Schafer
On Tue, 8 Jul 2003 05:36:59 -0700, "Richard A. Lowe"
<ch*****@yumspamyumYahoo.com> wrote: 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
Thanks Jonathan, I've pasted it below, however keep in
mind that other SendInput calls work as expected, both
single clicks AND mouse movements. My original assumption
was that double-clicks were a different type of input, but
then I saw the example where a double-click is created via
sending two clicks in rapid succession.
[StructLayout(LayoutKind.Explicit)]
public struct MOUSEINPUT
{
[FieldOffset(0)] public int dx; //
4
[FieldOffset(4)] public int dy; //
4
[FieldOffset(8)] public int mouseData; // 4
[FieldOffset(12)] public int dwFlags; //
4
[FieldOffset(16)] public int time; //
4
[FieldOffset(20)] public int dwExtraInfo; //
4
}; -----Original Message----- Are you sure the structure is right? Can you post a copy
of yourdefinition of the structure?
Jonathan Schafer
On Tue, 8 Jul 2003 05:36:59 -0700, "Richard A. Lowe" <ch*****@yumspamyumYahoo.com> wrote:
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
Isaw on SendInput suggested simply queueing two click events, but this is not working for me, regardless of
thedelay 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
thedelay is 0, 50, 100 etc. How can I send a double-click?
TIA Richard
.
Actually, it's started working... funny, nothing changed :( -----Original Message----- Are you sure the structure is right? Can you post a copy
of yourdefinition of the structure?
Jonathan Schafer
On Tue, 8 Jul 2003 05:36:59 -0700, "Richard A. Lowe" <ch*****@yumspamyumYahoo.com> wrote:
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
Isaw on SendInput suggested simply queueing two click events, but this is not working for me, regardless of
thedelay 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
thedelay is 0, 50, 100 etc. How can I send a double-click?
TIA Richard
.
I searched through Google regarding SendInput and double-click. Every
post mentioned doing it the same way you were. I read in a couple of
posts that timing was an issue. This may be what you are
experiencing.
Jonathan Schafer
On Tue, 8 Jul 2003 14:38:49 -0700, "Richard A. Lowe"
<ch*****@yumspamyumYahoo.com> wrote: Actually, it's started working... funny, nothing changed :(
-----Original Message----- Are you sure the structure is right? Can you post a copy of yourdefinition of the structure?
Jonathan Schafer
On Tue, 8 Jul 2003 05:36:59 -0700, "Richard A. Lowe" <ch*****@yumspamyumYahoo.com> wrote:
I'm using P/Invoke to call SendInput (using code culled from these newsgroups!) to send mouse events to awindow.But I'm unsure how to send double-clicks. A VB6 articleIsaw on SendInput suggested simply queueing two click events, but this is not working for me, regardless ofthedelay 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 ifthedelay is 0, 50, 100 etc. How can I send a double-click?
TIA Richard
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Logan McKinley |
last post by:
need my C# app to send a character to a different application. I believe I
need to use the SendInput API call and to pass a KEYBDINPUT struct into
that but I am lost past that point. Here is the...
|
by: Tim |
last post by:
Hello All,
I am writing a program that checks for the NumLock status and turns the NumLock on if it is off.
I'm not sure what I'm overlooking at this point, but the code will compile and run, but...
|
by: Tim |
last post by:
Hello All,
I am writing a program that checks for the NumLock status and turns the NumLock on if it is off.
I'm not sure what I'm overlooking at this point, but the code will compile and run, but...
|
by: kumar_subrahmanya |
last post by:
Hi,
I am facing problems in sending mouse clicks via SendInput API.
Mouse clicks are being sent but at the X,Y co-ordinates.
I am mapping my monitor to the (0,0,65535,65535) virtual monitor as...
|
by: ^Def_JaM^ |
last post by:
I need a working sample of how to use the "SendInput" (as described in the WinAPI) method to emulate Unicode keystrokes. Most important is the fact that SendInput sample must be able to send Unicode...
|
by: John Dalberg |
last post by:
I have an app that keeps popping up a windows with a 'Yes' or 'OK' button
on it. I am trying to write a little app that automates hitting the enter
key so I don't have to do it myself.
I used...
|
by: =?Utf-8?B?TXJOb2JvZHk=?= |
last post by:
I am trying to find a good example of SendInput. Doing a search on google I
found two, one is incomplete and vague from the start and the other I copied
the code and tried running it and it was...
|
by: Eugeny Myunster |
last post by:
Hello all,
How can i emulate sizeof()
only for integers?
|
by: wkaibigan |
last post by:
I have the following code
Private Sub PictureBox_DoubleClick(ByVal sender As System.Object,
ByVal e As System.EventArgs)
Try
Dim p As PictureBox = CType(sender, PictureBox)
Dim filetemp As...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
| |