使用GetVersionEx获得的他们的版本号都是5.2阿
解决方案 »
- 使用write函数 第一次将数据直接写到文件尾部很耗时,能有什么改进的方法吗
- 谁有ListCtrl 带筛选功能扩展类,忘指教谢谢!~~~
- 如何获取web上的弹出对话框的相关接口
- 100分,在线等,急,我的程序不能在DEBUG下调试,只能运行,显示Access Violation.
- VC中,如何得到一张图片的所有象素点的灰度值呢?
- vc6.o过时了吗?
- 用ATL写的COM难道比VB写的COM还要耗空间吗?
- 怎么把字符数组的所有字符赋给字符串?
- 关于CTreeCtrl
- 我用MF_ENABLED去AppendMenu,可为什么显示出来却还是灰化的啊?
- 取不到CBitmap对象的BITMAP结构,专家请指点
- 网络俄罗斯方块vc
BOOL VerifyVersionInfo(
LPOSVERSIONINFOEX lpVersionInfo,
DWORD dwTypeMask,
DWORDLONG dwlConditionMask
);Parameters
lpVersionInfo
[in] Pointer to an OSVERSIONINFOEX structure containing the operating system version requirements to compare. The dwTypeMask parameter indicates the members of this structure that contain information to compare.
You must set the dwOSVersionInfoSize member of this structure to sizeof(OSVERSIONINFOEX). You must also specify valid data for the members indicated by dwTypeMask. The function ignores structure members for which the corresponding dwTypeMask bit is not set.dwTypeMask
[in] Members of the OSVERSIONINFOEX structure to test. This parameter can be one or more of the following values.Value Meaning
VER_BUILDNUMBER
0x0000004 dwBuildNumber
VER_MAJORVERSION
0x0000002 dwMajorVersion
If you are testing the major version, you must also test the minor version and the service pack version.
VER_MINORVERSION
0x0000001 dwMinorVersion
VER_PLATFORMID
0x0000008 dwPlatformId
VER_SERVICEPACKMAJOR
0x0000020 wServicePackMajor
VER_SERVICEPACKMINOR
0x0000010 wServicePackMinor
VER_SUITENAME
0x0000040 wSuiteMask
VER_PRODUCT_TYPE
0x0000080 wProductType dwlConditionMask
[in] Type of comparison to use for each lpVersionInfo member being compared. To build this value, call the VerSetConditionMask function or the VER_SET_CONDITION macro once for each OSVERSIONINFOEX member being compared.
Return Values
If the currently running operating system satisfies the specified requirements, the return value is a nonzero value.If the current system does not satisfy the requirements, the return value is zero and GetLastError returns ERROR_OLD_WIN_VERSION.If the function fails, the return value is zero and GetLastError returns an error code other than ERROR_OLD_WIN_VERSION.Res
The VerifyVersionInfo function retrieves version information about the currently running operating system and compares it to the valid members of the lpVersionInfo structure. This enables you to easily determine the presence of a required set of operating system version conditions. It is preferable to use VerifyVersionInfo rather than calling the GetVersionEx function to perform your own comparisons.Typically, VerifyVersionInfo returns a nonzero value only if all specified tests succeed. However, major, minor, and service pack versions are tested in a hierarchical manner because the operating system version is a combination of these values. If a condition exists for the major version, it supersedes the conditions specified for minor version and service pack version. (You cannot test for major version greater than 5 and minor version less than or equal to 1. If you specify such a test, the function will change the request to test for a minor version greater than 1 because it is performing a greater than operation on the major version.)The function tests these values in this order: major version, minor version, and service pack version. The function continues testing values while they are equal, and stops when one of the values does not meet the specified condition. For example, if you test for a system greater than or equal to version 5.1 service pack 1, the test succeeds if the current version is 6.0. (The major version is greater than the specified version, so the testing stops.) In the same way, if you test for a system greater than or equal to version 5.1 service pack 1, the test succeeds if the current version is 5.2. (The minor version is greater than the specified versions, so the testing stops.) However, if you test for a system greater than or equal to version 5.1 service pack 1, the test fails if the current version is 5.0 service pack 2. (The minor version is not greater than the specified version, so the testing stops.)To verify a range of system versions, you must call VerifyVersionInfo twice. For example, to verify that the system version is greater than 5.0 but less than or equal to 5.1, first call VerifyVersionInfo to test that the major version is 5 and the minor version is greater than 0, then call VerifyVersionInfo again to test that the major version is 5 and the minor version is less than or equal to 1.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.To verify whether the current operating system is either the Media Center or Tablet PC version of Windows, call GetSystemMetrics.Example Code
For an example, see Verifying the System Version.Requirements
Client Requires Windows XP or Windows 2000 Professional.
Server Requires Windows Server 2003 or Windows 2000 Server.
Header Declared in Winbase.h; include Windows.h.
Library Link to Kernel32.lib.
DLL Requires Kernel32.dll.
Unicode Implemented as VerifyVersionInfoW (Unicode) and VerifyVersionInfoA (ANSI).
现在是通过两步完成的
第一加载Kernel32.dll中的文件重定向函数,如果失败则说明是32位系统,成功则说明是64系统,但是存在函数实际存在但加载失败的情况,虽然估计这种情况比较少见
第二步是读注册表HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName来判断系统界贴了,谢谢各位