取正在运行的DLL或EXE的路径

function GetSelfPath: string;
var
  ModuleName: string;
  i: Integer;
begin
  SetLength(ModuleName, 255);
  GetModuleFileName(HInstance, PChar(ModuleName), Length(ModuleName));
  i := LastDelimiter('\', ModuleName);
  Result := Copy(ModuleName, 1, i);
end;

你可能感兴趣的:(dll)