Loosing current directory

forum.sourcecode (2000-2005) & forum.td.sourcecode (2005-2010)

Loosing current directory

Post by G G » 16 Mar 2006, 17:28

 Posted by:  G G 

Hi, Ng.
In my app I use a SalDlgOpenFile() to choose an Access D.B. to open with ole
db and import data from, but, after this, the program looses the current
directory so it cannot find reports that resides in the same directory of
the app.
1 - How can I get the current directory?
2 - How can I set the curent directory?
With VisDosGetCurDir I must pass the drive but the application is shared on
a net.
Thank you.


Posts: 2204
Joined: 27 Apr 2021, 12:40
Location: Germany

Re: Loosing current directory

Post by RainerE » 16 Mar 2006, 17:42

 Posted by:  Rainer Ebert 

Try SalFileGetCurrentDirectory() and SalFileSetCurrentDirectory().


Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 2370
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: Loosing current directory

Post by Jeff Luther » 16 Mar 2006, 17:53

 Posted by:  Jeff Luther 

I have seen this too: with a File/Open... in TD its initial directory is what-
ever was the last directory opened in another Windows application. There are
a couple ways to handle managing what your 'home'/current directory should be:

1) I'm working with a group now and our solution is to maintain startup_parms
info. in a UDV - a functional class. Info. like start/home directory, user
name/password, authority privleges on the db, etc. are stored at pgm. start.
Later, we always make sure we pass the full path for any file we open. That
way we can find any QRPs or other files.

2) I've also kept this info. in a .INI file, like home=, etc. (You can
see this in action with my analyze utility, available on the linked page
shown below. Run TD_Analyze and note the 1st time it's run it looks for its
INI file. If it doesn't find it, it writes one to disk -- saving the directory
where the appl. was started from -- and uses that first time opportunity to
display a welcome msg. and the About box.

Here some other info. from your msg:
> 1 - How can I get the current directory? - SalFileGetCurrentDirectory ( strPath )
> 2 - How can I set the curent directory? - SalFileSetCurrentDirectory ( strPath )

"With VisDosGetCurDir" - Right, and Help for this function references another
VT function called VisDosGetCurDrive(), which isn't even available in TD!

Best Regards,
Jeff Luther/PC Design
info: www.pulpcards.com/gupta/


Re: Loosing current directory

Post by G G » 16 Mar 2006, 18:03

 Posted by:  G G 

OK, Rainer, a little lapsus. I save the current dir in a string then I set
it again when I live the window.
Thank you.

Return to “td.sourcecode”

Who is online

Users browsing this forum: [Ccbot] and 0 guests