VB6 API获取操作系统类型
0:win95/98/me/nt4.01:xp/20002:20033:win7/vista/2008能做到这样就行了网上一直找不到http://zhidao.baidu...
0 : win95/98/me/nt4.0
1 : xp/2000
2 : 2003
3 :
win7/vista/2008
能做到这样就行了
网上一直找不到
http://zhidao.baidu.com/question/362964526.html 这有个例子,但在win7 系统下返回win xp,原因不明,找到不想关的API帮助方根 展开
1 : xp/2000
2 : 2003
3 :
win7/vista/2008
能做到这样就行了
网上一直找不到
http://zhidao.baidu.com/question/362964526.html 这有个例子,但在win7 系统下返回win xp,原因不明,找到不想关的API帮助方根 展开
展开全部
void CMainPage::OnBnClickedVersion()
{
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
OSVERSIONINFOEX osvi;
SYSTEM_INFO si;
PGNSI pGNSI;
BOOL bOsVersionInfoEx;
ZeroMemory(&si, sizeof(SYSTEM_INFO));
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi);
if (!bOsVersionInfoEx)
{
return ;
}
pGNSI = (PGNSI)GetProcAddress(GetModuleHandle(_T("kernel32.dll")),
"GetNativeSystemInfo");
if (NULL != pGNSI)
{
pGNSI(&si);
}
else
{
GetSystemInfo(&si);
}
CString strMajor;
if ((VER_PLATFORM_WIN32_NT == osvi.dwPlatformId) &&
(osvi.dwMajorVersion > 4))
{
strMajor = _T("Microsoft ");
switch (osvi.dwMajorVersion)
{
case 6:
if (osvi.dwMinorVersion == 0)
{
if( osvi.wProductType == VER_NT_WORKSTATION )
{
strMajor += _T("Windows Vista ");
}
else
{
strMajor += _T("Windows Server 2008 ");
}
}
else if (osvi.dwMinorVersion == 1)
{
strMajor += _T("Windows 7");
}
if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
{
strMajor += _T(", 64 bits");
}
else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_INTEL )
{
strMajor += _T(", 32 bits");
}
break;
case 5:
if (osvi.dwMinorVersion == 2 )
{
if ( osvi.wSuiteMask==VER_SUITE_STORAGE_SERVER )
{
strMajor += _T("Windows Storage Server 2003");
}
else if ((osvi.wProductType == VER_NT_WORKSTATION) &&
(si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64))
{
strMajor += _T("Windows XP Professional x64 Edition");
}
else
{
strMajor += _T("Windows Server 2003 ");
}
if ( osvi.wProductType != VER_NT_WORKSTATION )
{
if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64 )
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
{
strMajor += _T("Datacenter Edition for Itanium-based Systems");
}
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
{
strMajor += _T("Enterprise Edition for Itanium-based Systems");
}
}
else if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
{
strMajor += _T( "Datacenter x64 Edition");
}
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
{
strMajor += _T( "Enterprise x64 Edition");
}
else
{
strMajor += _T( "Standard x64 Edition");
}
}
else
{
if ( osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER )
{
strMajor += _T( "Compute Cluster Edition");
}
else if( osvi.wSuiteMask & VER_SUITE_DATACENTER)
{
strMajor += _T( "Datacenter Edition");
}
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
{
strMajor += _T( "Enterprise Edition");
}
else if ( osvi.wSuiteMask & VER_SUITE_BLADE)
{
strMajor += _T( "Web Edition");
}
else
{
strMajor += _T( "Standard Edition");
}
}
}
}
else if (osvi.dwMinorVersion == 1)
{
strMajor += _T("Windows XP ");
if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
{
strMajor += _T( "Home Edition");
}
else
{
strMajor += _T( "Professional");
}
}
else if (osvi.dwMinorVersion == 0)
{
strMajor += _T("Windows 2000 ");
if ( osvi.wProductType == VER_NT_WORKSTATION )
{
strMajor += _T( "Professional");
}
else
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
{
strMajor += _T( "Datacenter Server");
}
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
{
strMajor += _T( "Advanced Server");
}
else
{
strMajor += _T( "Server");
}
}
}
break;
default:
strMajor = _T("未知版本");
break;
}
}
CString strBuild;
if( _tcslen(osvi.szCSDVersion) > 0 )
{
strBuild = osvi.szCSDVersion;
}
CString strResult;
strResult.Format(_T("%s %s build %d"), strMajor, strBuild, osvi.dwBuildNumber);
AfxMessageBox(strResult);
C++代码,给你参考了.
更多追问追答
追问
C++没学我哪看得懂
追答
就是调用API,然后进行处理了.我没有时间给你转VB啊
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询