var
hModule: THandle;
buff: array[0..255] of Char;
begin
hModule := GetModuleHandle('Yourdllname.dll');
GetModuleFileName(hModule, buff, sizeof(buff));
dllpath:=ExtractFilePath(buff);
工程自己编译出来的dll:
function LocalPath: string;
var
FileName: array[0..254] of char;
begin
GetModuleFileName(HInstance, FileName, 255);
Result := ExtractFilePath(FileName);
end;