网站首页  词典首页

请输入您要查询的函数:

 

术语 getversionex
释义 GetVersionEx
语法:
C++
BOOL WINAPI GetVersionEx(
__inout LPOSVERSIONINFO lpVersionInfo
);
GetVersionEx函数
检索有关当前操作系统。
参数
lpVersionInfo [ in , out ]
一个OSVERSIONINFO或OSVERSIONINFOEX结构,接收操作系统的信息。
在调用GetVersionEx函数,设置结构dwOSVersionInfoSize成员,适当的指示哪些数据结构被传递给该函数。
返回值
如果函数成功,返回值是一个非零值。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。函数失败如果您指定的OSVERSIONINFO或OSVERSIONINFOEX结构dwOSVersionInfoSize成员无效值。
备注
确定当前的操作系统通常是不是最好的方法,以确定是否一个特定的操作系统功能存在。这是因为操作系统可能有新功能,可再发行的DLL中添加。而不是使用GetVersionEx,以确定操作系统平台或版本号,测试的功能本身的存在。有关更多信息,请参阅操作系统版本。
GetSystemMetrics函数提供了有关当前操作系统的补充资料。
ProductSetting
Windows XP媒体中心EditionSM_MEDIACENTER
Windows XP入门者EditionSM_STARTER
视窗XP平板电脑EditionSM_TABLETPC
Windows Server 2003的R2SM_SERVERR2
要查询特定的操作系统或操作系统功能,使用ISO文件功能。该GetProductInfo函数检索产品类型。
来获取远程计算机上的操作系统的信息,使用NetWkstaGetInfo功能,Win32_OperatingSystem WMI类,或IADsComputer接口OperatingSystem财产。
要比较当前系统版本应有的版本,使用VerifyVersionInfo函数,而不使用GetVersionEx履行自己的比较。
如果兼容模式实际上是,报告的GetVersionEx功能的操作系统,因为它确定本身,这可能不是操作系统的安装。例如,如果在兼容模式的影响,GetVersionEx报告的操作系统是应用程序兼容性选择。
实例
当使用GetVersionEx函数来确定是否您的应用程序在一个操作系统,版本号的检查版本上运行,特别是大于或等于所需的版本号。这确保了测试操作系统的更新版本成功。例如,如果应用程序需要Windows XP或更高版本,使用下面的测试。
#include
#include
void main()
{
OSVERSIONINFO osvi;
BOOL bIsWindowsXPorLater;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
bIsWindowsXPorLater =
( (osvi.dwMajorVersion > 5) ||
( (osvi.dwMajorVersion == 5) && (osvi.dwMinorVersion >= 1) ));
if(bIsWindowsXPorLater)
printf("The system meets the requirements.\\n");
else printf("The system does not meet the requirements.\\n");
}
为例,用于标识当前操作系统,请使用该系统版本。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesGetVersionExW(Unicode)和GetVersionExA(ANSI)的
参见
GetVersion
操作系统版本
OSVERSIONINFO
OSVERSIONINFOEX
系统信息功能
VerifyVersionInfo
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==GetVersionEx Function
Retrieves information about the current operating system.
Syntax
C++
BOOL WINAPI GetVersionEx(
__inout LPOSVERSIONINFO lpVersionInfo
);
Parameters
lpVersionInfo [in, out]
An OSVERSIONINFO or OSVERSIONINFOEX structure that receives the operating system information.
Before calling the GetVersionEx function, set the dwOSVersionInfoSize member of the structure as appropriate to indicate which data structure is being passed to this function.
Return Value
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call GetLastError . The function fails if you specify an invalid value for the dwOSVersionInfoSize member of the OSVERSIONINFO or OSVERSIONINFOEX structure.
Remarks
Identifying the current operating system is usually not the best way to determine whether a particular operating system feature is present. This is because the operating system may have had new features added in a redistributable DLL. Rather than using GetVersionEx to determine the operating system platform or version number, test for the presence of the feature itself. For more information, see Operating System Version .
The GetSystemMetrics function provides additional information about the current operating system.
ProductSetting
Windows XP Media Center EditionSM_MEDIACENTER
Windows XP Starter EditionSM_STARTER
Windows XP Tablet PC EditionSM_TABLETPC
Windows Server 2003 R2SM_SERVERR2

To check for specific operating systems or operating system features, use the IsOS function. The GetProductInfo function retrieves the product type.
To retrieve information for the operating system on a remote computer, use the NetWkstaGetInfo function, the Win32_OperatingSystem WMI class, or the OperatingSystem property of the IADsComputer interface.
To compare the current system version to a required version, use the VerifyVersionInfo function instead of using GetVersionEx to perform the comparison yourself.
If compatibility mode is in effect, the GetVersionEx function reports the operating system as it identifies itself, which may not be the operating system that is installed. For example, if compatibility mode is in effect, GetVersionEx reports the operating system that is selected for application compatibility .
Examples
When using the GetVersionEx function to determine whether your application is running on a particular version of the operating system, check for version numbers that are greater than or equal to the desired version numbers. This ensures that the test succeeds for later versions of the operating system. For example, if your application requires Windows XP or later, use the following test.
#include
#include
void main()
{
OSVERSIONINFO osvi;
BOOL bIsWindowsXPorLater;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
bIsWindowsXPorLater =
( (osvi.dwMajorVersion > 5) ||
( (osvi.dwMajorVersion == 5) && (osvi.dwMinorVersion >= 1) ));
if(bIsWindowsXPorLater)
printf("The system meets the requirements.\\n");
else printf("The system does not meet the requirements.\\n");
}
For an example that identifies the current operating system, see Getting the System Version .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesGetVersionExW (Unicode) and GetVersionExA (ANSI)
See Also
GetVersion
Operating System Version
OSVERSIONINFO
OSVERSIONINFOEX
System Information Functions
VerifyVersionInfo
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms724451(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:17:50