code a click of a certain button in an application that was started from VB?

aspirant

New member
Joined
May 22, 2009
Messages
2
Programming Experience
Beginner
Hello forum!
This is my first post..and it is a question. Hope some day I will be able to provide also answers...
I started a third-party external application using Process.Start function. Does anybody know how I can code a click of a certain button in that application (the name of which I know)?

Thank you.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,335
Location
Sydney, Australia
Programming Experience
10+
You will need to invoke the Windows API for that. As you started the process you can use Process.MainWindowHandle to get the handle of the app's main window. You can then use FindWindowEx to get the handle of the button. You can then use SendMessage to send a BM_CLICK message to the button.

If you search online you'll certainly be able to find examples of those two functions as they are two of the most commonly used.
 

aspirant

New member
Joined
May 22, 2009
Messages
2
Programming Experience
Beginner
Thank you jmcilhinney.

For showing me the direction for solving my problem. I searched the keywords mentioned by you in a number of books, but I didn't find them. I searched them in the web and found a number of sites where they are referenced. I went through the sites, but since I am doing my first steps in programming, I still have a problem writing the code, because I don't imagine the structure that I ought to follow and can't find certain examples that perform the steps I mentioned.
If you have ready examples, please post them because they will help a lot. I will continue studying and improving my knowledge. Thank you again.
 
Top Bottom