UINT GetSystemDirectory(    LPTSTR lpBuffer, // address of buffer for system directory 
    UINT uSize  // size of directory buffer 
   );

解决方案 »

  1.   

    var
      WinSystemDir: string;
    begin
      WinSystemDir := GetWinSystemDir;
      //取Windows System 目录
      if (Length(WinSystemDir) >= 1) and (WinSystemDir[Length(WinSystemDir)] <> '\')
        then
        WinSystemDir := WinSystemDir + '\';
    end;
      

  2.   

    function GetWinSystemDir: string;
    var
      Path: array[0..255] of Char;
    begin
      Result := '';
      try
        GetSystemDirectory(Path, SizeOf(Path));
        Result := StrPas(Path);
      except
      end;
    end;
      

  3.   

    HRESULT SHGetFolderPath(
        HWND hwndOwner,
        int nFolder,
        HANDLE hToken,
        DWORD dwFlags,
        LPTSTR pszPath
    );