Hi friends. Would someone tell me how a program intalled in a subdirectory, can it know the path (eg: c:\dir1\dir2\myfile.exe)to its own place. In this example when my file myfile.exe is executed it must to know its complete path.
Posted on 2001-02-09 21:16:00 by JR
Hi JR, Use API GetCurrentDirectory. best regards, czDrillard
Posted on 2001-02-09 21:24:00 by czDrillard
GetCurrentDirectory won't do. In most cases, it seems to give you the correct folder. But it is not the correct way to obtain the current path of the program: 1) SetCurrentDirectory can change the current directory easily 2) If the user creates a shortcut for your prog and specifies a new working directory, GetCurrentDirectory will return the working directory, not the program path. The correct way (in my opinion) is to call GetModuleFileName and parse the path from the full pathname.
Posted on 2001-02-10 03:35:00 by Iczelion
Hi JR, To know the complete path of a prog when it is executed, I use GetAppPath, ADDR buffer : buffer receive the complete path of the prog, but not the filename. Vom-bonjour:-() This message was edited by Vom-bonjour:-(), on 2/10/2001 9:36:05 AM
Posted on 2001-02-10 09:35:00 by Vom-bonjour:-()