Hello. I have been searching for some time now to find a way to send mouse clicks to another application not using mouse x,y coordinates, and I have not yet found a solution (either that posts/examples are not even compilable w/o info to proceed, or the info is not there to get me started). I would like to send mouse clicks to another application (that is not written .net). I am not all that C# guru, my background is embedded systems.
I am starting the application that I want to send mouse clicks to, via
startInfo = new ProcessStartInfo(@"C:\Code\abc.exe");
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
hence, the application receiving the mouse clicks does not have focus and is running as hidden. Some posts mentioned to use WinID program to get info about the buttons for which to send mouse clicks.
Can anyone provide an end-to-end solution for this problem? I have tried many different ways for the past few days now and have not reached a conclusive method. Your help or direction is greatly appreciated.
Is my current way even possible? i.e running application in hidden style and sending mouse events.
(btw. I am using Visual Express2008 with .NET 3.5 SP1. )
thanks
Loading
Danatas GerviPosted Oct 1, 2009, 9:58 AM
LaithPosted Oct 2, 2009, 9:18 PM
Roei BarPosted Oct 2, 2009, 3:08 AM
here is the article for how to use mouse events
http://www.pinvoke.net/default.aspx/user32/mouse_event.html
LaithPosted Oct 2, 2009, 12:31 AM
Master BillaPosted Oct 1, 2009, 11:45 PM
You can do with this through the message passing between exes.
http://www.codeguru.com/csharp/.net/net_general/patterns/article.php/c7259
thank you
LaithPosted Oct 1, 2009, 8:38 PM
Roei BarPosted Oct 1, 2009, 3:10 PM
http://xdmessaging.codeplex.com/
its a way to send messages via windows messaging
LaithPosted Oct 1, 2009, 3:08 PM
const int WM_LBUTTONDOWN = 0x0201;
bool result = PostMessage(hWndC, WM_LBUTTONDOWN, ???, 0);
thanks
LaithPosted Oct 1, 2009, 2:43 PM
I had to add another dll import for it to compile...
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
Still the Edit button on the note pad is not firing. Not sure what is the problem. Despite I had the notepad maximized.
Also, what is VK_X represents?
thanks