A Windows process created from an exe file has access to the command string that invoked it, including its file’s path and filename. eg. C:\MyApp\MyApp.exe --help.
But this is not so for a DLL invoked via LoadLibrary. Does anyone know of a way for a function loaded via DLL to find out what its path and filename are?
Specifically, I’m interested in a solution using the Delphi Programming Language, but I suspect that the answer would be pretty much the same for any language.
I think you’re looking for GetModuleFileName.
http://www.swissdelphicenter.ch/torry/showcode.php?id=143:
Untested though, been some time since I worked with Delphi 🙂