在XP下他获得是 c:\windows
但是在win2003 下他变成 C:\Documents and Settings\Administrator\Windows\他调用的到底是哪一句API啊?获取c:\windows我知道

解决方案 »

  1.   

    是不是这个
    char szPath[256]={0};
    GetSystemDirectory(szPath,256);
      

  2.   

    The GetSystemWindowsDirectory function retrieves the path of the shared Windows directory on a multiuser system. UINT GetSystemWindowsDirectory(
      LPTSTR lpBuffer,  // buffer to receive directory name
      UINT uSize        // size of name buffer
    );
      

  3.   

    UINT GetSystemWindowsDirectory(
      LPTSTR lpBuffer,  // buffer to receive directory name
      UINT uSize        // size of name buffer
    );
    接到后,需要进行判断缓冲区是否足够长,UINT的结果表示需要的长度,如果超常,需要按照新的长度进行重新读取。