Click to See Complete Forum and Search --> : Open External Executable
Cleech
August 27th, 2001, 10:02 AM
I'm trying to set up a simple VB progam that will give the user 3 options. 1&2) Open on of to Executable files 3)Exit
I'm not sure if I should use an Open Statement, Run Command etc.
Also, I need to determine whether the Application is already active and if it is, inform the user with a Message box.
If anyone could give me a little help with this, It would be greatly appreciated.
Thanks.
Cimperiali
August 27th, 2001, 10:15 AM
It may be useful the "shell" command, but it will run the executable asincronously, at it will require some works to keep track. if you're going to call Office applications, it will be better to use com (reference the library inside vb and create an istance of those programs). This is not fiew code, so it may be better to have a look to numerous example:
Make a search here (look on top: forum index|FAQ|Edit Profile|...|Search|) for "WaitforSingleObject" and "Excel" or "Application" and read questions and answers.
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
Gek
August 27th, 2001, 10:18 AM
To run the executeable you can use the Shell command. As for determining if the program is already running, I would be glad if someone told me a way that works with every 32bit windows version.
hth,
daniel
DSJ
August 27th, 2001, 10:19 AM
I think the commonly accepted method for doing this is using the Shell() function to start the other applications.
If you wrote the other applications being called by the first one, you can use App.PrevInstance property to determine if another copy of the application is already running, if not, you'll have to use some API Calls to try and find out if they're already running... I use the EnumWindows API.
Hope this helps!
DJ
DSJ
August 27th, 2001, 10:22 AM
I use the EnumWindows API which works OK on 95 and 98... don't know about NT.
DJ
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.