利用InstallShield12制作安装包之三:判断操作系统类型的多种方法
来源:互联网 发布:程序员该怎么建立博客 编辑:程序博客网 时间:2024/05/01 13:47
用InstallShield制作安装包时,有时候需要判断操作系统的类型(如Windows XP或者是Windows Vista等),本人通过上InstallShield的官方社区(http://community.flexerasoftware.com/)找到了一些解决办法,现将本人整理过的方法晒出来,与各位一起分享。
方法一:采用注册表的方式进行判断,例程如下:
NUMBER nOS,nvResult;
STRING svOS;
nOS = REGDB_NUMBER;
RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
RegDBGetKeyValueEx( "SOFTWARE//Microsoft//Windows NT//CurrentVersion","CurrentVersion", nOS, svOS, nvResult);
if (svOS == "6.0") then
MessageBox("We are on Vista!", INFORMATION);
else
if (svOS == "5.1") then
MessageBox("We are on XP!",INFORMATION);
endif;
endif;
方法二:采用GetSystemInfo函数进行处理,请看下面的说明信息:
SYSINFO.nWinMajor:
4 The operating system is Windows NT 4.0.
5 The operating system is Windows Server 2003 R2, Windows Server 2003, Windows XP,or Windows 2000.
6 The operating system is Windows Vista or Windows Server 2008.
SYSINFO.nWinMinor:
0 The operating system is Windows Vista, Windows Server 2008, Windows 2000, or Windows NT 4.0.
1 The operating system is Windows XP.
2 The operating system is Windows Server 2003 R2, Windows Server 2003, or Windows XP Professional x64 Edition.
GetSystemInfo(WINMINOR, nvResult, svResult);
GetSystemInfo(WINMAJOR, nvResult, svResult);
方法二可以通过InstallShield的帮助文档找到更详细的信息。
方法三:通过SYSINFO.WINNT的方法进行判断,例程如下:
if (SYSINFO.WINNT.bWinVista) then
if (SYSINFO.nOSProductType = VER_NT_WORKSTATION) then
// 当前操作系统为Windows Vista
endif;
endif;
if (SYSINFO.WINNT.bWinXP) then
当前操作系统为Windows XP
endif;
上述三种方法是最为常见的解决办法,当然亦可能还有其他的方法可以进行处理。
- 利用InstallShield12制作安装包之三:判断操作系统类型的多种方法
- 利用InstallShield12制作安装包之二:利用InstallScript脚本进行最基本的编程
- 利用InstallShield12制作安装包之一:认识InstallShield12
- 利用InstallShield12制作安装包之四:隐藏准备安装界面
- 利用InstallShield12制作安装包之五:常见系统DLL/OCX控件信息汇集
- InstallShield判断操作系统类型的多种方法
- 使用installshield12制作的安装包在卸载时杀死正在运行的程序
- 操作系统安装的多种方法
- 用InstallShield制作安装包时,有时候需要判断操作系统的类型(如Windows XP或者是Windows Vista等
- 如何判断操作系统类型的三种方法
- InstallShield12的静默安装
- 利用Javascript判断操作系统的类型
- RecyclerView的Item多种类型的选择和不同样式展示之利用框架方法实现
- 制作deb包的三种方法
- 制作deb包的三种方法
- linux多种安装包格式的安装方法
- linux多种安装包格式的安装方法
- Python 之 安装模块的多种方法
- 远程桌面传文件
- nginx 缓存服务器
- POJ2388
- 编导是做什么的?编导具体做什么
- 浅谈SUN JVM内存管理与应用服务器的优化 之SUN JVM内存管理
- 利用InstallShield12制作安装包之三:判断操作系统类型的多种方法
- VC++中什么是BSTR、LPSTR以及LPWSTR呢
- POJ2418
- Eclipse3.2.2中安装Spring IDE2.0.1
- POJ2632
- db_cache_size、shared_pool_size一些初始化参数为什么是0?
- 2440PWMTimer启动流程
- 明朝时代
- Word效率工具(WET)