Inno Setup determines whether the Windows system version (in fact, Delphi code, can also check the domain controller and the Home Edition)

Source: Internet
Author: User

1. Set Windows Minimum version requirements

[Setup]: minversion

Format: A.BB,C.DD, here a.bb is the Windows version, C.DD is the Windows NT version.

Default value: 4.0,4.0

Description: This command lets you specify that your software must run the minimum version of Windows or Windows NT, and to prevent your program from running under Windows or Windows NT, specify "0" in one of the minimum versions. The build number and/or Security Service pack level can be included in the version number. If the user system does not fit the minimum version requirement, the installer will appear with an error message and exit.

Segment Judging system version [/b][/align][align=left] Syntax:procedureGetwindowsversionex (varVersion:twindowsversion); [/align] [Align=left] Description: Returns extended information about the version of Windows in a record. [/align]   [Align=left] [b] Twindowsversion[/b] Definition: [/align][align=left] twindowsversion =Record[/align] major:cardinal;//Major Version numberminor:cardinal;//Sub-version numberbuild:cardinal;//Build Numberservicepackmajor:cardinal;//Service Pack major version numberservicepackminor:cardinal;//Service Pack Sub-version numberNtplatform:boolean;//true if it is based on NT platformProducttype:byte;//Product type (see below)Suitemask:word;//Installed product components (see below)   End;   [Align=left] [b] Producttype[/b] Object values can be one of the following values: [/align][align=left] Ver_nt_workstation//represents a non-server version of Windows (for example, workstation, Professional, or Home edition) [/align] Ver_nt_domain_controllerver_nt_server[align=left] (if the user is running Windows the/98/me, or the product type cannot be determined, it can also be zero. ) [/align][align=left] [b]suitemask[/b] object values can be a combination of the following values: [/align][align=left] ver_suite_backoffice[/align] VER_SUITE_B Lade//set up the Windows Server 2003 on the network editionver_suite_datacenter ver_suite_enterprise ver_suite_embeddednt ver_suite_personal//set up in Windows XP, such as Home Editionver_suite_singleuserts ver_suite_smallbusiness ver_suite_smallbusiness_restricted VER_SUITE_TERMINAL[align=left] (in Windows the/98/me and NT4.0, Suitemask is always zero. )[/Align] [Align=left]3example [/align][align=left] The following examples tell you how to install in some versions of Windows and check the service pack level on multiple OS editions. [/Align] [Code] [Code]functionInitializesetup:boolean;varversion:twindowsversion; s:string;beginGetwindowsversionex (Version); //do not accept installation in the Home edition of Windows  ifVersion.suitemask andVer_suite_personal <>0  Then  beginSuppressiblemsgbox ('This program cannot be installed in the Home edition of Windows. ', Mbcriticalerror, MB_OK, MB_OK); Result:=False;  Exit; End; //do not accept installation in a domain controller  ifVersion.producttype = Ver_nt_domain_controller Then  beginSuppressiblemsgbox ('This program cannot be installed on a domain controller. ', Mbcriticalerror, MB_OK, MB_OK); Result:=False;  Exit; End; //in Windows 2000, check SP4  ifVersion.ntplatform and(Version.major=5) and(Version.minor=0) and(Version.servicepackmajor<4) Then  beginSuppressiblemsgbox ('When you run Windows 2000, you must install Service Pack 4. ', Mbcriticalerror, MB_OK, MB_OK); Result:=False;  Exit; End; //in Windows XP, check the SP2  ifVersion.ntplatform and(Version.major=5) and(Version.minor=1) and(Version.servicepackmajor<2) Then  beginSuppressiblemsgbox ('when you run Windows XP, you must install 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

Inno Setup determines whether the Windows system version (in fact, Delphi code, can also check the domain controller and the Home Edition)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.