~Resolved~Screwy problems with Shell
This one has me stumped. I wrote a program that you add a program to a list, made for Chat server's where I hang out. Now, if my program is in a different directory than the server, it doesn't find *Any* of it's configuration files and they all get re-created making the person lose all their server data. If you run the program from the same directory there is no problem at all.
I am guess it's similar to how command works, where you have to change to the right directory before executing an exe.
My question is, how do I make this work right without slapping a copy of the program in every directory?
Re: Screwy problems with Shell....
The problem with Shell is that there are no parameters for specifying the working directory. There is, although,
the CurDir function that allows you to specify this in another line of code. Preferably before the shell call.
Another option is to use the ShellExecute API to start you processes instead of Shell. ShellExecute API has a parameter
for specifying the working directory.
Re: Screwy problems with Shell....
CurDir will only return the current directory. The function to change the directory is ChDir.
Re: Screwy problems with Shell....
Doh! Shows how much I use it. I always use ShellExecute over Shell now-a-days.
Thanks for catching that one Joacim ;)
Re: Screwy problems with Shell....
I used the ShellExecute API, the ChDir didn't do jack but return errors. I tried it before I posted the thread.
Thanks a lot for the suggestion RobDog