Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

shell

Posted on 2002-03-03
7
Medium Priority
?
308 Views
Last Modified: 2010-05-02
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.
0
Comment
Question by:ralphy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 17

Expert Comment

by:inthedark
ID: 6838142
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.
0
 
LVL 17

Expert Comment

by:inthedark
ID: 6838148
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.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6838366
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
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 8

Accepted Solution

by:
glass_cookie earned 400 total points
ID: 6838680
Hi!

I believe this is the problem:

"\14\setup.exe"

On the root directory, the app.path returns a "D:\" or whatever drive letter, depending on your settings.  So, App.Path + "\14\setup.exe" is actually

"D:\\14\setup.exe"

which is of course not a valid path.  Change "\14\setup.exe" to "14\setup.exe" and it should work fine : )

That's it!

glass cookie : )
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6838926
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.
0
 

Author Comment

by:ralphy
ID: 6839011
I figured it would be something simple.
Thanks a lot
ralphy
0
 
LVL 8

Expert Comment

by:glass_cookie
ID: 6839229
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 : )
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question