Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: Carsten Carlos on March 05, 2003, 05:34:25 pm

Title: How to set working-directory in VB?
Post by: Carsten Carlos on March 05, 2003, 05:34:25 pm
Sorry, might be a bit offtopic, but I just can't find it anywhere how to do it!

My little vb-program can execute MAME when it is located in the same folder, but I just can't find how to set the working-directory so I can keep my program anywhere else!

Somehow I can't find anything in the help-file nor at the web.  :(
Title: Re:How to set working-directory in VB?
Post by: Lilwolf on March 05, 2003, 06:20:55 pm
I dont know (java programmer)

but have you tried launching
"C:\mame\mame.ext c:\mame\roms\zookeeper.zip"

in java, I can specify the directory to start it in.

Title: Re:How to set working-directory in VB?
Post by: Howard_Casto on March 05, 2003, 07:13:54 pm
that won't help.....
Do it like this:

chDrive path
chdir path


btw... fe.donkeyfly.com is the best place for these types of questions.  

Title: Re:How to set working-directory in VB?
Post by: SirPoonga on March 05, 2003, 07:20:22 pm
Made sure you you store the current path in a variable before changing path.

myAppPath = CurDir
chDir mamedir
ShellAndWaitA "mame.exe"
chDir = myAppPath


As HC said, goto fe.donkeyfly.com.  I just made you a programmer, you can access the programming sections.
Title: Re:How to set working-directory in VB?
Post by: Howard_Casto on March 05, 2003, 07:37:08 pm
Umm sirp you haven't had to store the current path since about vb 3.0

The real path to your application is always stored in app.path

It's fixed and thus is unchangable by the user.    
Title: Re:How to set working-directory in VB?
Post by: Minwah on March 05, 2003, 07:47:57 pm
Is there any point doing the ChDrive / ChDir stuff?  I do it before launching an emu but I can't remember why (I send the whole emulator + rom path too).
Title: Re:How to set working-directory in VB?
Post by: Carsten Carlos on March 06, 2003, 02:05:30 am
Quote
s HC said, goto fe.donkeyfly.com.  I just made you a programmer, you can access the programming sections.

Thanx, Howie & SirPoonga, great service, I'll see you there! :)
Title: Re:How to set working-directory in VB?
Post by: Howard_Casto on March 06, 2003, 02:32:36 pm
Is there any point doing the ChDrive / ChDir stuff?  I do it before launching an emu but I can't remember why (I send the whole emulator + rom path too).

Yes it sets the working directory for the file you have launched.  Lets say you launch mame.  Now the entire mame exe is loaded into memory as yo run it, so of course it's going to play fine, but when it tries to parse the mame.ini it has no clue where the hell it came from and thus can't find the mame.ini.  

Now if you use the createprocess call to launch a game then it's no biggie as the path to the app is an option you MUST send along with the activation string. In other words it sets the chdir and chdrive for you.