Click here to Skip to main content
15,921,941 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello,

I would like to open an exe and click the button to open the file from an exe app.

I know I can call:

System.Diagnostics.Process.Start("pathname");

how can I call the process to "click the button" on the application that I just open?

Thanks!
Posted

1 solution

Hi,

you need to P/Invoke some functions from user32.dll.

Here's a example of how to achieve it:
http://stackoverflow.com/questions/5206223/press-button-in-another-applications-window[^]

Pinvoke.net provides useful informations about User32.dll (and many other) functions, and how to use them.
http://www.pinvoke.net/default.aspx/user32.FindWindowEx[^]

Also at Windows Dev Center:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633500%28v=vs.85%29.aspx[^]

Most important function is SendMessage, which sends Messages (Commands) to your Window:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms644950%28v=vs.85%29.aspx[^]

Available Messages you can send to your Window:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms644927%28v=vs.85%29.aspx#system_defined[^]

With Best Regards
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900