Detect the full path and file name of where the DLL is running from? (Views: 100)
How can I detect (from a dynamic link library) the full path and file name of where the DLL is running from?
The following example demonstrates a dll function that will detect the full path of where the dll was loaded from.
procedure ShowDllPath stdcall;
TheFileName: array[0..MAX_PATH] of char;
FillChar(TheFileName, sizeof(TheFileName), #0);
GetModuleFileName(hInstance, TheFileName, sizeof(TheFileName));
MessageBox(0, TheFileName, 'The DLL file name is:', mb_ok);
<< Back to main page