导航
  • 主页
  • VC/MVC基础类
  • .NET 技术
  • VC/MFC界面
  • VC/MFC 进程
  • VC/MFC 算法
  • VC/MFC 数据库
  • VC/MFC HTML

请问怎样知道当前运行的系统是98还是2000?

ferretzhu 2002-07-31 12:54:11
请问怎样知道当前运行的系统是98还是2000?
...全文
10 点赞 收藏 3
写回复
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
studentforever 2002-07-31
typedef struct _OSVERSIONINFO{
DWORD dwOSVersionInfoSize;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
DWORD dwBuildNumber;
DWORD dwPlatformId;
TCHAR szCSDVersion[ 128 ];
} OSVERSIONINFO;
其中,dwPlatformId
Identifies the operating system platform. This member can be one of the following values: Value Platform
VER_PLATFORM_WIN32s Win32s on Windows 3.1.
VER_PLATFORM_WIN32_WINDOWS Win32 on Windows 95 or Windows 98.
For Windows 95, dwMinorVersion is zero.

For Windows 98, dwMinorVersion is greater than zero.

VER_PLATFORM_WIN32_NT Win32 on Windows NT.
回复
studentforever 2002-07-31
OSVERSIONINFO OsVersionInfo;//包含操作系统版本信息的数据结构
OsVersionInfo.dwOSVersionInfoSize= sizeof(OSVERSIONINFO);
GetVersionEx(&OsVersionInfo);//获取操作系统版本信息
回复
碍踢工匠 2002-07-31
OSVERSIONINFOEX osvi;
BOOL bOsVersionInfoEx;

ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);

if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
{
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) )
MessageBox("´íÎó");
}

switch (osvi.dwPlatformId)
{
case VER_PLATFORM_WIN32_NT:

if ( osvi.dwMajorVersion <= 4 )
MessageBox("Microsoft Windows NT ");

if ( osvi.dwMajorVersion == 5 )
MessageBox("Microsoft Windows 2000 ");

break;

case VER_PLATFORM_WIN32_WINDOWS:

if ((osvi.dwMajorVersion > 4) ||
((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion > 0)))
{
MessageBox("Microsoft Windows 98 ");
}
else MessageBox("Microsoft Windows 95 ");

break;

case VER_PLATFORM_WIN32s:

MessageBox("Microsoft Win32s ");
break;
}
回复
发动态
发帖子
VC/MFC
创建于2007-09-28

1.5w+

社区成员

VC/MFC相关问题讨论
申请成为版主
社区公告
暂无公告