Installshield判断系统版本

本文介绍了在Installshield中如何判断系统版本号和是否为32位或64位的方法,包括通过SYSINFO结构体、查询注册表、调用GetSystemInfo函数,以及利用SYSINFO.bIsWow64属性和Components的Platform Suite(s)设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Installshield判断系统版本

 

 

一、判断系统版本号:


1、用SYSINFO结构体获取

 

 if ((SYSINFO.nWinMajor == 5 ) && (SYSINFO.nWinMinor >= 0)) then 
     MessageBox ("The system is more than XP.", SEVERE);
else
     MessageBox ("The system is Window XP and before.", SEVERE);
 endif; 


 

2、通过查询注册表来判断系统:


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;


 

3、调用 GetSystemInfo函数,具体函数用法参见help文档。

 

 

Operating

system

Version

 number

dwMajor

Version

dwMinor

Version

Other

Windows 7

6.1

6

1

OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION

Windows Server 2008 R2

6.1

6

1

OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION

Windows Server 2008

6.0

6

0

OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION

Windows Vista

6.0

6

0

OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION

Windows Server 2003 R2

5.2

5

2

GetSystemMetrics(SM_SERVERR2) != 0

Windows Server 2003

5.2

5

2

GetSystemMetrics(SM_SERVERR2) == 0

Windows XP

5.1

5

1

Not applicable

Windows 2000

5.0

5

0

Not applicable

Operating

system

Version

 number

dwMajor

Version

dwMinor

Version

Other

Windows 7

6.1

6

1

OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION

Windows Server 2008 R2

6.1

6

1

OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION

Windows Server 2008

6.0

6

0

OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION

Windows Vista

6.0

6

0

OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION

Windows Server 2003 R2

5.2

5

2

GetSystemMetrics(SM_SERVERR2) != 0

Windows Server 2003

5.2

5

2

GetSystemMetrics(SM_SERVERR2) == 0

Windows XP

5.1

5

1

Not applicable

Windows 2000

5.0

5

0

Not applicable

操作系统版本参数参考:

win8                   6.2      6       2  

 

Operating

system

Version

 number

dwMajor

Version

dwMinor

Version

Other

Windows 7

6.1

6

1

OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION

Windows Server 2008 R2

6.1

6

1

OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION

Windows Server 2008

6.0

6

0

OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION

Windows Vista

6.0

6

0

OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION

Windows Server 2003 R2

5.2

5

2

GetSystemMetrics(SM_SERVERR2) != 0

Windows Server 2003

5.2

5

2

GetSystemMetrics(SM_SERVERR2) == 0

Windows XP

5.1

5

1

Not applicable

Windows 2000

5.0

5

0

Not applicable

Operating

system

Version

 number

dwMajor

Version

dwMinor

Version

Other

Windows 7

6.1

6

1

OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION

Windows Server 2008 R2

6.1

6

1

OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION

Windows Server 2008

6.0

6

0

OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION

Windows Vista

6.0

6

0

OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION

Windows Server 2003 R2

5.2

5

2

GetSystemMetrics(SM_SERVERR2) != 0

Windows Server 2003

5.2

5

2

GetSystemMetrics(SM_SERVERR2) == 0

Windows XP

5.1

5

1

Not applicable

Windows 2000

5.0

5

0

Not applicable


二、判断系统是32位还是64


1InstallShield 中,写脚本可以使用 SYSINFO.bIsWow64 来判断

//判断Windows作系统是否为64位
   if(SYSINFO.bIsWow64==1) then    
   	       MessageBox( "该系统为64位系统", MB_OK ); 	        
   endif;  




2对于同时支持32/64位的打包来说,不仅限于脚本,Components等的属性都可以有效控制。在ComponentsPlatform Suite(s)中设置平台互斥。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值