How could I simulate a left-click with a mouse. I have no trouble using keys (sendkeys project from codeproject), but I can't get it to simulate a left-click.
Can anyone help me?
How could I simulate a left-click with a mouse. I have no trouble using keys (sendkeys project from codeproject), but I can't get it to simulate a left-click.
Can anyone help me?
~guitarist809~
http://p2p.wrox.com/topic.asp?TOPIC_ID=38639
The OP is using .NET, but I believe he's attempting calls out of a win32 api dll so it should be enough to send you in the right direction.
What is C++?
Since you posted in the Windows forum and not the C# forum, I'll assume you want to simulate a left mouse button using Win32 API.
With that said, give the following a try to see if it works:
Code:INPUT Input={0}; // left MB down Input.type = INPUT_MOUSE; Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN; SendInput(1,&Input,sizeof(Input)); // lef MB up ZeroMemory(&Input,sizeof(INPUT)); Input.type = INPUT_MOUSE; Input.mi.dwFlags = MOUSEEVENTF_LEFTUP; SendInput(1,&Input,sizeof(Input));