Documents and Settings\Administrator\Application Data\Microsoft\Templates\
这个目录一般都是固定的,主要是得到系统盘,GetWindowsDirectory(),这个函数得到系统目录,它所对应的盘就是系统盘。

解决方案 »

  1.   

    晕倒,[盘符]\Documents and Settings\Administrator\Application Data\都是动态变化的,只是后面的固定而已,要取得Application Data目录,自己使用GetSpecialFolderLocation即可。
      

  2.   

    Path := GetFolderPath( $001A ) + '\Microsoft\Templates\';可能多了一个"\"!!!
      

  3.   

    不知上面几个函数是在哪个单元
    老东西。拿出来也许有用
    uses shlobj, activex, comobj;{***************************************************************
     *
     * 名    称 : GetSpecialFolder
     * 编    写: BlackFox
     * 说    明 : 取得指定的文件夹
     * 入    口 : nFolder,文件夹索引,参看shlobj
     * 出    口 : 返回文件夹路径(无斜杠)
     * 历    史 :
     * 创建日期  :2001-05-30
     ****************************************************************}function GetSpecialFolder(nFolder: Integer): string;
    var
      pIDL: pItemIDList;
      Buffer: array[0..MAX_PATH] of char;
      Malloc: IMalloc;
    begin
      try    try
          OLECheck(SHGetMalloc(Malloc));
          OLECheck(SHGetSpecialFolderLocation(0, nFolder, pIDL));
          if ShGetPathFromIdList(pIDL, PChar(@Buffer)) then        Result := Buffer
          else
            Result := '';    except
          Result := '';    end;
      finally
        if pIDL <> nil then
          Malloc.Free(pIDL);
      end;end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      ShowMessage(GetSpecialFolder(CSIDL_APPDATA) + '\Microsoft\Templates\');
    end;
      

  4.   

    '\Device\HarddiskVolume1\Documents and Settings\Administrator\Application Data\Microsoft\Templates\'
    就是
    'C:\Documents and Settings\Administrator\Application Data\Microsoft\Templates\'
      

  5.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      s1,s2:array[1..40] of char;
    begin
      GetWindowsDirectory(@s1,40);
      GetSystemDirectory(@s2,40);
      ShowMessage('Windows目录: '+s1);
      ShowMessage('System目录 :'+s2);  
    end;