Locating another application's coordinates

Greetings.

First message here.

I would like to know how I can simulate a click on another application knowing the application's name and the local coordinate where to click.

I know I can use SetCursorPos, and SendMessage to click.

What I don't know is how to determine if the other application is started, where it is and how to convert the local coordinates of where to click (static known location) to the screen coordinate.

Thank you for your time, its appreciated :)

Antoine

Sooo, you pretty much had the answer to your question and now you want to know what you hypothetically knew. :P LOL! No problem.

First thing: FindWindowEx(). http://msdn.microsoft.com/en-us/library/ms633500%28VS.85%29.aspx. Gets you a window handle.

Second: The window position and its size can be obtained using GetWindowInfo(). http://msdn.microsoft.com/en-us/library/ms633516%28VS.85%29.aspx.

You can further examine the main window using FindWindowEx() to find the button you need to click, to finally send it a message. I know it is general, but I don't know how much of this you already have.

Disclaimer: I have never done such a thing as to try to controll an external application. I am guessing that these functions work with windows created by other processes, but I don't know that first hand.

You might also want to consider a CBT hook. CBT stands for Computer-Based Training. Windows will notify your application when something related happens, like a particular window being created. This could also prove helpful in your case.

Cheers!!
Topic archived. No new replies allowed.