Click to See Complete Forum and Search --> : Set Shell Path at Runtim


jsanfilippo
March 13th, 2001, 11:06 AM
I have a VB6 application that is the startup.exe on a CD-Rom.
Using the Shell command, this exe will launch one of two things on a
command click - either another .exe to install a plug-in, or an HTML within
the default browser.

My code is as follows:

Private Sub Command2_Click()
Dim wd$
Dim pa$
Dim fe$

wd = "D:\" ' set the working directory
fe = "D:\default.htm" 'set the file to execute
pa = "" ' Set the command line parameters

ShellExecute hwnd, "open", fe, pa, wd, 1


Question: Rather than manually defining the path, ie. "D:\", is there some
way to determine where the user's CD-Rom is, and assign that to the path at
runtime? Otherwise, the above code only works IF the user has d:\ as their
CD-Rom!

Thanks for any assistance!
jamie

Clearcode
March 13th, 2001, 11:29 AM
The path from which a program is run is held in:

App.Path




You could use this, as your exe is being run from the CD Rom.

HTH,
Duncan


-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com

jsanfilippo
March 13th, 2001, 11:42 AM
Thank you! Worked like a charm! Such a simple solution, and yet it took me all morning to find it. :)

jamie