What's the difference between double clicking a file and shelling it?

Meridian2000
06-07-2005, 06:31 AM
I've written a program which at the start runs a small external program, the problem I have is if you open up the directory that the program sits in and double click it, it loads ok. but if I try to "Shell" it from VB it fails because it can't load in the INI file that's associated with it. (the ini file is in the same directory). I've tried taking the program along with it's ini file out of the directory and placed it in the root directory of the hard drive, but still no luck

Any help would be appreciated

OMID SOFT
06-07-2005, 07:01 AM
I've written a program which at the start runs a small external program, the problem I have is if you open up the directory that the program sits in and double click it, it loads ok. but if I try to "Shell" it from VB it fails because it can't load in the INI file that's associated with it. (the ini file is in the same directory). I've tried taking the program along with it's ini file out of the directory and placed it in the root directory of the hard drive, but still no luck

Any help would be appreciated

Try to change the directory before using shell command, it may solve the problem.

TeraBlight
06-07-2005, 07:12 AM
Try to change the directory before using shell command, it may solve the problem.

Yeah, that's it. Say I am running a VB project from test1.
At the same level as test1, there is a folder test2 which contains prog.exe and text.txt. prog.exe reads text.txt

This gets a file not found:


MsgBox CurDir
Shell "../test2/prog.exe"


whereas this works fine


ChDir "../test2"
MsgBox CurDir
Shell "prog.exe"


I believe VB always defaults to App.Path, which is usually where you run your VB program from.

Meridian2000
06-07-2005, 08:34 AM
Yeah, that's it. Say I am running a VB project from test1.
At the same level as test1, there is a folder test2 which contains prog.exe and text.txt. prog.exe reads text.txt

This gets a file not found:


MsgBox CurDir
Shell "../test2/prog.exe"


whereas this works fine


ChDir "../test2"
MsgBox CurDir
Shell "prog.exe"


I believe VB always defaults to App.Path, which is usually where you run your VB program from.

tried that, doesn't work, not in this case anyway

TeraBlight
06-07-2005, 08:43 AM
tried that, doesn't work, not in this case anyway

Hmmm. Did you try, as a quickfix, just putting the prog and ini file into your project directory?

Meridian2000
06-07-2005, 09:15 AM
Hmmm. Did you try, as a quickfix, just putting the prog and ini file into your project directory?


yes, that seems to work

so how come the chdir command doesn't work in this case?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum