Software Archive
Read-only legacy content
17060 Discussions

Function to return full path of executable

grtoro
Beginner
1,366 Views
Is there a CVF function that returns the full path of the executable that calls it? I seem to remember seeing it but I cannot find it now.

I want my program to know where to find help and configuration files (when installed in other people's machines) without having to go through a complicated installation process. This program will be running on various W* machines (95, 98, Me, NT4, 2000, etc.).

Thanks,

Gabriel
0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
1,366 Views
It's
GetModuleFileName(NULL, sDirectory, LEN(sDirectory))
where sDirectory is character(MAX_PATH). Have in mind that it returns zero-terminated string, so you should probably strip terminal char(0) after that:
sDirectory=sDirectory(1: INDEX(sDirectory, char(0))-1)


Jugoslav
0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,366 Views
...heh, twilight zone -- I'm becoming a prophet :-). I mistakenly gave that same answer to the thread "Dialog Box in a DLL" two days ago.
0 Kudos
Reply