Laith

Laith

  • NA
  • 11
  • 0

How to send mouse clicks to another application

Oct 1 2009 9:39 AM
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

Answers (9)