Link to home
Start Free TrialLog in
Avatar of ralphy
ralphy

asked on

shell

I have a program with three different versions for three different screen resolutions. I begin the autorun on the cd with a getscreenres program adapted from the example on vb-world written in vb6. then the user is asked to pick the setup according to the screen resolution. I have three buttons. each of the buttons is supposed to shell to the correct setup. On the root dirrectory of the cd I have the autorun.inf file, the getscreenres.exe file and the three directories 14, 17, 19 each containing the setup for each version. I use the following code for each button:
Dim x
     x = Shell(App.Path + "\14\setup.exe", 1)
I get a file not found.
The three setup versions are all written in VB4 16 bit, but i don't think this should cause a problem. It must be my shell directory structure.
Avatar of inthedark
inthedark
Flag of United Kingdom of Great Britain and Northern Ireland image

I suspect that the problem is that your AutoRun is running a ile in a sub folder. For example:

[AutoRun]
Open=MyStartFolder\Select.EXE

So your app is running in a sub folder on the CD.

If this is the case try this code:

x = Shell(Left(App.Path,2) + "\14\setup.exe", 1)


If folder "14" is a sub folder from the initial exe file then the problem lies in another place.
When testing Setup programs I always start esting on a CDRW or in a folder on the hard disk.

In the save folder as the exe files I locake a file "DEBUG" with a length >0.

So in my code I would say:

DebugMode = Len(Dir(App.Path + "\Debug")) > 0

If DebugMode then

    ' here you will see what yo are realy tring to run.
    Msgbox "Shell to: " + App.Path + "\14\setup.exe",Vbinformation, "Debug Mode"

end if

x = Shell(App.Path + "\14\setup.exe", 1)

Hope this helps.
Two matters:
dim x

replace with :
dim x as long

*************
x = Shell(App.Path + "\14\setup.exe", 1)

replace with
x = Shell(App.Path & "\14\setup.exe", 1)

Cheers
ASKER CERTIFIED SOLUTION
Avatar of glass_cookie
glass_cookie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Glass has a nice idea!
But take care that if it is not root, the resulting string could be:
"D:\some_path14\setup.exe"
Doing a check before continue could be better.
Avatar of ralphy
ralphy

ASKER

I figured it would be something simple.
Thanks a lot
ralphy
Hi!

Thanks for the grade.  Anyway, here's a little piece of code for you to eliminate this error:

Dim Filepath As String
Filepath = "myfolder\myfile.dat"
If Len(App.Path) = 3 Then Filepath = App.Path & Filepath Else Filepath = App.Path & "\" & Filepath


That's it!

glass cookie : )