OSVERSIONINFO VerInfo;
VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 
GetVersionEx(&VerInfo); 
...............GetSystemDirectory

解决方案 »

  1.   

    UINT GetWindowsDirectory(
      LPTSTR lpBuffer,  // buffer for Windows directory
      UINT uSize        // size of directory buffer
    );
    此函数获得window 目录UINT GetSystemDirectory(
      LPTSTR lpBuffer,  // buffer for system directory   
      UINT uSize        // size of directory buffer
    );
    此函数获得window下system 目录
      

  2.   

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

  3.   

    看MSDN中的文档:
    dwVersion = GetVersion();
     
    // Get major and minor version numbers of Windows
    dwWindowsMajorVersion =  (DWORD)(LOBYTE(LOWORD(dwVersion)));
    dwWindowsMinorVersion =  (DWORD)(HIBYTE(LOWORD(dwVersion)));
    // Get build numbers for Windows NT or Win32s
    if (dwVersion < 0x80000000)                // Windows NT
        dwBuild = (DWORD)(HIWORD(dwVersion));
    else if (dwWindowsMajorVersion < 4)        // Win32s
        dwBuild = (DWORD)(HIWORD(dwVersion) & ~0x8000);
    else         // Windows 95 -- No build numbers provided
        dwBuild =  0;