WIN32 API编程--获取Winodws版本信息

#include <stdio.h>
#include <conio.h>
#include <Windows.h>

void main(void)
{
 OSVERSIONINFOEX WinVer;
 WinVer.dwOSVersionInfoSize=sizeof(OSVERSIONINFOEX);
 GetVersionEx((OSVERSIONINFO*)&WinVer);
 printf("Windows Version:%x.%x\n",WinVer.dwMajorVersion,WinVer.dwMinorVersion);
 printf("Service Pack:%s\n",WinVer.szCSDVersion);
 printf("Build Number:%d\n",WinVer.dwBuildNumber);
 printf("Service Pack Major:%d\n",WinVer.wServicePackMajor);
 printf("Service Pack Minor:%d\n",WinVer.wServicePackMinor);
 printf("Product Type:0x%x\n",WinVer.wProductType);
 printf("Suit Mask:0x%x\n",WinVer.wSuiteMask);
 getch();
}

函数GetVersionEx参考详见MSDN.

posted @ 2005-11-25 15:56  Max Woods  阅读(734)  评论(0编辑  收藏  举报