Delphi中判断操作系统是否是Windows7


本文整理自网络,侵删。

 Delphi2007编译的时候去掉GetVersionExA(@VI)中的@
function GetWindowsVersionString: AnsiString;
var
VI: TOSVersionInfoA;
begin
VI.dwOSVersionInfoSize := SizeOf(TOSVersionInfoA);
if GetVersionExA(@VI) then
with VI do
Result := Trim(
Format(
'%d.%d build %d %s',
[dwMajorVersion, dwMinorVersion, dwBuildNumber, szCSDVersion]
)
)
else
Result := '';
end;

function GetWindowsVersion: String; //读取操作系统版本
var
AWin32Version: Extended;
os:string;
begin
os:='Windows ';
AWin32Version := StrtoFloat(format('%d.%d' ,[Win32MajorVersion, Win32MinorVersion]));
if Win32Platform=VER_PLATFORM_WIN32s then
Result := os + '32'
else if Win32Platform=VER_PLATFORM_WIN32_WINDOWS then
begin
if AWin32Version=4.0 then
Result := os + '95'
else if AWin32Version=4.1 then
Result := os + '98'
else if AWin32Version=4.9 then
Result := os + 'Me'
else
Result := os + '9x'
end
else if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
if AWin32Version=3.51 then
Result := os + 'NT 3.51'
else if AWin32Version=4.0 then
Result := os + 'NT 4.0'
else if AWin32Version=5.0 then
Result := os + '2000'
else if AWin32Version=5.1 then
Result := os + 'XP'
else if AWin32Version=5.2 then
Result := os + '2003'
else if AWin32Version=6.0 then
Result := os + 'Vista'
else if AWin32Version=6.1 then
Result := os + '7'
else
Result := os ;
end
else
Result := os + '??';
Result:=Result + ' '+GetWIndowsVersionString;
end;

相关阅读 >>

Delphi 判断文本文件的编码格式

Delphi webbrowser 释放注意事项

Delphi memo1自动循环上下滚屏

Delphi 实现对xml文件的读写操作

Delphi提示‘error loading midas.dll’的原因及解决方案

Delphi使焦点固定到一个button上

汇编数据宽度和字节序

Delphi 使用钩子函数 - 钩子链和 callnexthookex 的返回值

Delphi xe中windows7新的taskbar功能的使用

Delphi firemonkey处理图形的方式与vcl处理图形的方式大不相同

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...