Software Archive
Read-only legacy content
17060 Discusiones

Function to return full path of executable

grtoro
Principiante
1.365 Vistas
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 Respuestas
Jugoslav_Dujic
Colaborador Valioso II
1.365 Vistas
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
Jugoslav_Dujic
Colaborador Valioso II
1.365 Vistas
...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.
Responder