September 30, 2020, 10:29:37 am

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Another SYSTEM command question with a "startpath" problem.

Started by 3Dpdk, March 06, 2008, 01:00:27 pm

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

3Dpdk

I have another System command problem ...

The program I am writing attempts to run another program located in a different folder. This other program needs to know it's own startpath but when run by my program the startpath continues to point to my program's folder.

Is there a way to set the startpath in Windows XP to the new folder before my program ends?

I'm pretty sure it can be done because Paul has as a download utility, a file manager that does this very thing.

Any help would be greatly appriciated from anyone who may know how to do this or knows that it CAN'T be done.

Thanks

GWS

Hi,

I'm not sure I fully understand your question, but from within CB you can use the System command to change directory, or you can use this method:

Put this declare line near the start of your program. ('path$' can be any name you like)...

declare "kernel32",SetCurrentDirectoryA(path$:string)

Then use when needed to set your path. ("C:\" can be any path in a literal string or use a string variable)...

SetCurrentDirectoryA("C:\")

In the above example, when you access the drive then "C:\" will be the current path just like CD in DOS.

I don't know if this helps,  :)

Graham

Tomorrow may be too late ..

3Dpdk

Thank you Graham.

At first glance I believe this is exactly what I need, and a very simple solution at that!

The program being run from my program was looking in my folder instead of it's own for it's own ini files. This appears that I can set the path to the other program's folder before my "System" command to run the exe. The system command by itself didn't seem to work properly.

Thanks for your response, this puts the polish on my program I was looking for.

Paul