谢谢

解决方案 »

  1.   

    或是用API函数
    GetModuleName可以得到程序的全路径+文件名
    然后再用ExtractFilePath函数得到路径
      

  2.   

    代码实例
    var
      hModule : THandle;
      buff:  array[0..MAX_PATH] of Char;
    begin
      dwSize := MAX_PATH;
      hModule := GetModuleHandle(nil);
      GetModuleFileName(hModule, buff, dwSize);
      showmessage(ExtractFilePath(StrPas(buff));
    end;
      

  3.   

    ExtractFilePath(ParamStr(0))
    很简单
      

  4.   

    送你一个小函数Function LocalPath():string;
    begin
       result:=extractfilepath(paramstr(0));
    end;
      

  5.   

    ExtractFilePath(Application.ExeName);
      

  6.   

    function GetExePath():string;//取应用程序路径
    var
      ExePath:string;
      iPos,Index:integer;
    begin
       ExePath:=Application.ExeName;
       iPos := 0;
       for Index := 1 to Length(ExePath) do
        if ExePath[Index] = '\' then
         iPos := Index;
       Result := copy(ExePath,1,iPos - 1);
    end;