Как найти полный путь и имя файла запущенной DLL из самой DLL

Previous  Top  Next

    
 

 

 

Code:

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;

 

 

Автор: Олег Кулабухов

©Drkb::01999

       

Взято с http://delphiworld.narod.ru

 


 

 

Code:

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

 

 

 

©Drkb::02000

       

Взято с http://delphiworld.narod.ru