Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

START UP ANOTHER PROGRAM FROM WITHIN ?

Status
Not open for further replies.

C2it

Petroleum
Joined
Jun 27, 2007
Messages
504
Location
GB
Is it possible to start another existing '.exe' file from within a running visual basic executible ?

If so, can you tell me the relevant commands ?

Cheers.
 
You can use the ShellExecute API.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Thanks for that. I guess I can root out the code in my Peter Norton book.

A further question ... is it possible having started up that second program, to insert a word in a text box in the second program ?
 
No need to use API for the first Q, VB includes the Shell command - e.g. X = Shell("path\app.exe", vbMaximizedFocus)

For your second question use sendkeys
 
That's excellent, nearly there ... Can you please show me the syntax for 'sendkeys' ... it's not in my Norton book.
 
This is going well - thanks.

I can start another program, say called 'name' from within a running .exe with shell(name.exe) and write to it using SendKeys "words", for example. But there seems no control over exactly where the sendkeys statement places "words" in 'name.exe'. Is there some way to identify, say text1.text in the 'name.exe', as a destination for "word" ?
 
You could try looking for the hdc handle of the control

Alternatively use any keyboard shortcuts existing in the second program from SendKeys (another possibility is the correct number of tabs from sendkeys)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top