ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 判断Windows版本号 (转)

判断Windows版本号 (转)

原创 Linux操作系统 作者:gugu99 时间:2007-11-05 09:17:16 0 删除 编辑
判断Windows版本号 (转)[@more@]

api函数:GetVersionEx()
void __fastcall TForm1::FormCreate(Tobject *Sender)
{
  OSVERSIONINFO info ;
  info.dwOSVersionInfoSize = sizeof (info) ;
  GetVersionEx (&info) ;

  switch (info.dwPlatfoRmid)
  {
  case VER_PLATFORM_win32s:
    Label1->Caption = "System:  windows Win 32s" ;
    break ;
  case VER_PLATFORM_WIN32_WINDOWS:
    Label1->Caption = "System:  Windows 95" ;
    break ;
  case VER_PLATFORM_WIN32_NT:
    Label1->Caption = "System:  windows NT" ;
    break ;
  default:
    Label1->Caption = "System:  Unknown" ;
    break ;
  }

  Label2->Caption = String ("Version: ")
    + String ((int) info.dwMajorVersion) + "." + String((int)info.dwMinorVersion) ;
  Label3->Caption = String ("Build:  ") + String ((int) (info.dwBuildNumber & 0xFFFF)) ;
  Label4->Caption = String ("System Info:  ) + info.szCSDVersion + " ;
}
或者

The following code fragment illustrates how to extract information from the GetVersion return value:

 
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;

 

 

 

 

 

 


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10748419/viewspace-980827/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: ASP可逆算法 (转)
请登录后发表评论 登录
全部评论
  • 博文量
    3121
  • 访问量
    2644420