用GetVersionExprocedure TForm1.Button1Click(Sender: TObject);
var
myOS:TOSVersionInfo ;
begin
myOS.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
if GetVersionEx(myOS) then
begin
label1.Caption:=myos.szCSDVersion ;
label2.Caption:=floattostr(myos.dwOSVersionInfoSize);
label3.Caption:=floattostr(myos.dwMajorVersion);
label4.Caption:=floattostr(myos.dwMinorVersion);
label5.Caption:=floattostr(myos.dwBuildNumber);
case myOS.dwPlatformId of
VER_PLATFORM_WIN32s: label6.Caption := 'Win 32s under Windows 3.1';
VER_PLATFORM_WIN32_WINDOWS: label6.Caption := 'Windows 9X';
VER_PLATFORM_WIN32_NT: label6.Caption := 'Windows NT OR Windows2000';
end;
end;
end;
var
myOS:TOSVersionInfo ;
begin
myOS.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
if GetVersionEx(myOS) then
begin
label1.Caption:=myos.szCSDVersion ;
label2.Caption:=floattostr(myos.dwOSVersionInfoSize);
label3.Caption:=floattostr(myos.dwMajorVersion);
label4.Caption:=floattostr(myos.dwMinorVersion);
label5.Caption:=floattostr(myos.dwBuildNumber);
case myOS.dwPlatformId of
VER_PLATFORM_WIN32s: label6.Caption := 'Win 32s under Windows 3.1';
VER_PLATFORM_WIN32_WINDOWS: label6.Caption := 'Windows 9X';
VER_PLATFORM_WIN32_NT: label6.Caption := 'Windows NT OR Windows2000';
end;
end;
end;
解决方案 »
- 各位同仁们,在Delphi中,当用户通过DBGrid向数据库输入不合法的数据时,会出现异常,程序停止运行,此时该如何避免?
- Access存储过程输出参数
- 我想问一个关于简单的form问题?
- 如何将16进制的字符串转换成字节型的数组?
- 如何判断一个程序是否为2D/3D游戏??
- 同志们,请教几个问题!请帮帮忙看一下好吗?
- 一个ADO方面的问题
- 请教delphi中有关sql语句的问题
- 谁有TAHMBackground,TAHMLabel,TAHMPanel,TAHMFormSlide,TAHMFormManager的控件?在线求助!
- 动态库调用的问题(vb示例转delphi)
- 很简单的一个问题,但我不知我忽略了什么?
- ADO与ACCESS连接问题!!!!!!!
VER_PLATFORM_WIN32_WINDOWS System is Windows 95/98/Me.
VER_PLATFORM_WIN32_NT System is Windows NT/2000/XP.用GetVersionEx可以得到更多的信息。
GetVersionEx function was developed because many existing Windows applications err when examining the DWORD return value of a GetVersion function call, transposing the major and minor version numbers packed into that DWORD. The GetVersionEx function forces applications to explicitly examine each element of version information, and allows for future enhancements to that information.DWORD GetVersion(VOID)
ParametersThis function has no parameters. Return ValuesIf the function succeeds, the return value is a DWORD value that contains the major and minor version numbers of Windows in the low order word, and information about the operating system platform in the high order word.
For all platforms, the low order word contains the version number of Windows. The low-order byte of this word specifies the major version number, in hexadecimal notation. The high-order byte specifies the minor version (revision) number, in hexadecimal notation. To distinguish between operating system platforms, use the high order bit and the low order byte, as shown in the following table:Platform High order bit Low order byte (major version number)
Windows NT zero 3 or 4
Windows 95 1 4
Win32s with Windows 3.1 1 3
For Windows NT and Win32s, the remaining bits in the high order word specify the build number.
For Windows 95 the remaining bits of the high order word are reserved.ResThis function does not return the current version number of MS-DOS.
The following code fragment illustrates how to extract information from the GetVersion return value:
dwVersion = GetVersion();
// Get major and minor version numbers of WindowsdwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));// Get build numbers for Windows NT or Win32sif (dwVersion < 0x80000000) // Windows NT
dwBuild = (DWORD)(HIWORD(dwVersion));
else if (dwWindowsMajorVersion < 4) // Win32s
dwBuild = (DWORD)(HIWORD(dwVersion) & ~0x8000);
else // Windows 95 -- No build numbers provided dwBuild = 0;
See AlsoGetVersionEx