inno setup判断是Windows系统版本(其实还是Delphi代码,还能检查域控制器和家庭版)
2016-10-27 18:05
701 查看
1.设置Windows最低版本要求
[Setup]: MinVersion
格式: a.bb,c.dd,这里 a.bb 是 Windows 版本,c.dd 是 Windows NT 版本。
默认值: 4.0,4.0
[align=left] 描述:这个指令让你指定你的软件运行必须的 Windows 或 Windows NT 版本最小版本,要防止你的程序在 Windows 或 Windows NT 下运行,请在最小版本中的一个指定“0”。构建号和/或安全服务包级别可以包含在版本号中。如果用户系统不适合最小版本需求,安装程序将出现一个错误消息并退出。[/align]
https://zhidao.baidu.com/question/184517203.html http://www.sgzystudio.cn/forum.php?mod=viewthread&tid=166
[Setup]: MinVersion
格式: a.bb,c.dd,这里 a.bb 是 Windows 版本,c.dd 是 Windows NT 版本。
默认值: 4.0,4.0
[align=left] 描述:这个指令让你指定你的软件运行必须的 Windows 或 Windows NT 版本最小版本,要防止你的程序在 Windows 或 Windows NT 下运行,请在最小版本中的一个指定“0”。构建号和/或安全服务包级别可以包含在版本号中。如果用户系统不适合最小版本需求,安装程序将出现一个错误消息并退出。[/align]
段判断系统版本[/b][/align][align=left] 语法:procedure GetWindowsVersionEx(var Version: TWindowsVersion);[/align][align=left] 描述:返回记录中有关 Windows 版本的扩展信息。[/align][align=left] TWindowsVersion 定义: [/align][align=left] TWindowsVersion = record[/align] Major: Cardinal; // 主版本号 Minor: Cardinal; // 副版本号 Build: Cardinal; // 构建号 ServicePackMajor: Cardinal; // 服务包主版本号 ServicePackMinor: Cardinal; // 服务包副版本号 NTPlatform: Boolean; // 如果是基于 NT 平台则为 True ProductType: Byte; // 产品类型 (看下面) SuiteMask: Word; // 安装的产品组件 (看下面) end; [align=left] ProductType 对象取值可以是下列值中的一个:[/align][align=left] VER_NT_WORKSTATION // 表示非服务器版本的 Windows (例如工作站、专业版或家庭版)[/align] VER_NT_DOMAIN_CONTROLLER VER_NT_SERVER [align=left] (如果用户运行于 Windows 95/98/Me,或产品类型不能确定,它也可以是零。)[/align][align=left] SuiteMask 对象取值可以是下列值的组合: [/align][align=left] VER_SUITE_BACKOFFICE[/align] VER_SUITE_BLADE // 设置在网络版的 Windows Server 2003 VER_SUITE_DATACENTER VER_SUITE_ENTERPRISE VER_SUITE_EMBEDDEDNT VER_SUITE_PERSONAL // 设置在比如家庭版的 Windows XP VER_SUITE_SINGLEUSERTS VER_SUITE_SMALLBUSINESS VER_SUITE_SMALLBUSINESS_RESTRICTED VER_SUITE_TERMINAL [align=left] (在 Windows 95/98/Me 和 NT 4.0,SuiteMask 总是为零。)[/align] [align=left]3.实例[/align][align=left] 下面的例子告诉你可以怎样在某些版本的 Windows 中不接受安装,并在多个操作系统版梧检查服务包等级。[/align][Code] function InitializeSetup: Boolean; var Version: TWindowsVersion; S: String; begin GetWindowsVersionEx(Version); // 不接受在家庭版的 Windows 中安装 if Version.SuiteMask and VER_SUITE_PERSONAL <> 0 then begin SuppressibleMsgBox('这个程序不能安装于家庭版的 Windows。', mbCriticalError, MB_OK, MB_OK); Result := False; Exit; end; // 不接受在域控制器中安装 if Version.ProductType = VER_NT_DOMAIN_CONTROLLER then begin SuppressibleMsgBox('这个程序不能安装于域控制器。', mbCriticalError, MB_OK, MB_OK); Result := False; Exit; end; // 在 Windows 2000,检查 SP4 if Version.NTPlatform and (Version.Major = 5) and (Version.Minor = 0) and (Version.ServicePackMajor < 4) then begin SuppressibleMsgBox('在 Windows 2000 运行时,必须安装 Service Pack 4。', mbCriticalError, MB_OK, MB_OK); Result := False; Exit; end; // 在 Windows XP 中,检查 SP2 if Version.NTPlatform and (Version.Major = 5) and (Version.Minor = 1) and (Version.ServicePackMajor < 2) then begin SuppressibleMsgBox('在 Windows XP 运行时,必须安装 Service Pack 2。', mbCriticalError, MB_OK, MB_OK); Result := False; Exit; end; Result := True; end;
https://zhidao.baidu.com/question/184517203.html http://www.sgzystudio.cn/forum.php?mod=viewthread&tid=166
相关文章推荐
- delphi判断windows系统是64位还是32位
- 判断系统是windows还是unix的代码
- 程序判断Windows系统是32bit还是64bit
- 查看cpu 以及linux和windows系统是32为还是64位?+查看操作系统版本
- 关于更新windows Service Pack 3 更新后系统登录出现“一个问题阻止Windows正确检查机器的许可证。错误代码 0x80070002”问题解决方案
- c判断windows的系统是32位还是64位
- C#判断系统是64位还是32位 支持.net4.0以前的版本
- delphi 判断是64位系统还是32为操作系统
- LINUX和windows下如何判断CPU和系统是32位还是64位
- userAgent,JS这么屌的用户代理,你造吗?——判断浏览器内核、浏览器、浏览器平台、windows操作系统版本、移动设备、游戏系统
- C# 判断当前系统是XP还是WIN7 .获取当前系统版本
- userAgent,JS用户代理检测——判断浏览器内核、浏览器、浏览器平台、windows操作系统版本、移动设备、游戏系统
- 使用cmd命令批处理判断windows系统是32bit还是64bit
- python判断windows系统是32位还是64位的方法
- delphi获取windows系统版本信息,大全,准确
- 通过C代码判断系统是32位还是64位
- delphi 判断是64位系统还是32为操作系统
- qt代码中判断windows/linux/arm等系统
- win32程序判断windows系统(是否为win7或是更高版本)
- python判断windows系统是32位还是64位的方法