Как найти полный путь и имя файла запущенной DLL из самой DLL
Falk0ner, вс, 06/07/2008 - 15:34.
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;
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;
Автор: Олег Кулабухов
Взято с http://delphiworld.narod.ru
function GetModuleFileNameStr(Instance: THandle): string;
var
buffer: array [0..MAX_PATH] of Char;
begin
GetModuleFileName( Instance, buffer, MAX_PATH);
Result := buffer;
end;
GetModuleFileNameStr(Hinstance); // dll name
GetModuleFileNameStr(0); // exe name
var
buffer: array [0..MAX_PATH] of Char;
begin
GetModuleFileName( Instance, buffer, MAX_PATH);
Result := buffer;
end;
GetModuleFileNameStr(Hinstance); // dll name
GetModuleFileNameStr(0); // exe name
Взято с http://delphiworld.narod.ru
Отправить комментарий