Current Working Folder

Hi All,

I am doing a system maintenance program as a background task (other tasks in Procontrol). Basically I check a few things and if there is a problem then I send off an email to the specified email address. However I am using relative paths for everything, else we would have to store all the paths etc int he database, which works fine until I make the Mapi (Mail API) call, which then changes the working folder to a common controls folder under program files. So once an email has been sent it all goes haywire.

What I need is someway to find the current working folder before making the mapi call and then set it back again after the call. Does anyone know how to do this please? Or atleast a starting point so I can look it up for myself?

Thank you all in advance,
Cya.
 
Here is some code that gets and sets the current directory - hope it helps.

Code:
PROCEDURE SetCurrentDirectoryA external "kernel32.dll":
    def input parameter  lpPathName       as Char no-undo.
end procedure.

file-info:file-name = ".".

message
    "Current directory is "
    file-info:full-pathname
    view-as alert-box.

run SetCurrentDirectoryA ("C:\WinNT").

file-info:file-name = ".".

message
    "Current directory is now "
    file-info:full-pathname
    view-as alert-box.


waynesingh said:
<snip>
What I need is someway to find the current working folder before making the mapi call and then set it back again after the call.
<snip>
 
Simon Sweetman said:
Here is some code that gets and sets the current directory - hope it helps.
Code:
PROCEDURE SetCurrentDirectoryA external "kernel32.dll":
def input parameter lpPathName as Char no-undo.
end procedure.

file-info:file-name = ".".

message
"Current directory is "
file-info:full-pathname
view-as alert-box.

run SetCurrentDirectoryA ("C:\WinNT").

file-info:file-name = ".".

message
"Current directory is now "
file-info:full-pathname
view-as alert-box.

Thank you very much mate. This will do the job nicely.

Cya.
 
Top