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中使用词霸2005的动态库xdictgrb.dll实现屏幕取词

Delphi截获和干扰窗体最小化�p最大化和关闭消息

Delphi系统默认语言与系统支持的语言列表

Delphi 快速删除非空文件夹

Delphi打开"我的电脑"等特殊文件夹

Delphi 获取计算机名称3

Delphi判断字符串是否是数字、字母、大小写字母

Delphi firedac 连接access mdb数据库的方法

Delphi 获取鼠标坐标大全方法

Delphi 用wininet 单元实现 post提交数据

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



打赏

取消

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

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

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

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

评论

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