Главная страница | назад





Article #16703: Detecting the full path/filename of a DLL

 Question and Answer Database
FAQ1703D.txt Detecting the full path/filename of a DLL
Category :Windows API
Platform :All
Product :All 32 bit
Question:
How can I detect (from a dynamic link library) the full path and
file name of where the DLL is running from?
Answer:
The following example demonstrates a dll function that will detect
the full path of where the dll was loaded from.
Example:
uses Windows;
procedure ShowDllPath stdcall;
var
TheFileName : array[0..MAX_PATH] of char;
begin
FillChar(TheFileName, sizeof(TheFileName), #0);
GetModuleFileName(hInstance, TheFileName, sizeof(TheFileName));
MessageBox(0, TheFileName, 'The DLL file name is:', mb_ok);
end;
7/16/98 4:31:28 PM

Last Modified: 01-SEP-99