取正在运行的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;

posted @ 2014-04-02 16:17  delphi中间件  阅读(2153)  评论(0编辑  收藏  举报