|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- ; ű Inno Setup ű ɣ
- ; йش Inno Setup űļϸİĵ
-
- #define MyAppName "ǻ"
- #define MyAppDir "xhwk"
- #define MyAppVersion "3.1.12"
- #define MyAppPublisher "ǻԭƼ˾"
- #define MyAppURL "http://www.xhkjedu.com/"
- #define MySourcePath "D:\Project\CSharp\xhwkclient\XHWK.WKTool\bin\x86\Debug\"
- #define MyAppExeName "ǻ.exe"
- #define MyIcoName "256.ico"
- #define MyTargetPath "D:\\ǻ-\"
-
- [Setup]
- ; ע: AppIdֵΪʶӦó
- ; ҪΪװʹͬAppIdֵ
- ; (Ҫµ GUIDڲ˵е "| GUID")
- AppId={{5869900A-3BE4-463E-B0A6-462AA7454AE2}
- AppName={#MyAppName}
- AppVersion={#MyAppVersion}
- ;AppVerName={#MyAppName} {#MyAppVersion}
- AppPublisher={#MyAppPublisher}
- AppPublisherURL={#MyAppURL}
- AppSupportURL={#MyAppURL}
- AppUpdatesURL={#MyAppURL}
- DefaultDirName={autopf}\{#MyAppDir}
- DisableProgramGroupPage=yes
- ; [Icons] ġquicklaunchiconĿʹ {userappdata} [Tasks] Ŀʺ IsAdminInstallMode ļ顣
- UsedUserAreasWarning=no
- ; ȡעͣڷǹװģʽУΪǰûװ
- ;PrivilegesRequired=lowest
- OutputDir={#MyTargetPath}
- OutputBaseFilename="{#MyAppName} v{#MyAppVersion}"
- SetupIconFile="{#MySourcePath}{#MyIcoName}"
- Compression=lzma
- SolidCompression=yes
- WizardStyle=modern
-
- [Languages]
- Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"
-
- [Tasks]
- Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone
- Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone; OnlyBelowVersion: 6.1; Check: not IsAdminInstallMode
-
- [Files]
- Source: "{#MySourcePath}{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
- Source: "{#MySourcePath}*"; Excludes: "ffmpeg.exe,\Log\*,\Temp,\Data";DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
-
- [Icons]
- Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
- Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
- Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
-
- [Run]
- Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
-
- [Code]
- // Զ庯жǷУΪҪжϵexe
- function KDetectSoft(strExeName: String): Boolean;
- //
- var ErrorCode: Integer;
- var bRes: Boolean;
- var strFileContent: AnsiString;
- var strTmpPath: String; // ʱĿ¼
- var strTmpFile: String; // ʱļݽ
- var strCmdFind: String; //
- var strCmdKill: String; // ֹ
- begin
- strTmpPath := GetTempDir();
- strTmpFile := Format('%sfindSoftRes.txt', [strTmpPath]);
- strCmdFind := Format('/c tasklist /nh|find /c /i "%s" > "%s"', [strExeName, strTmpFile]);
- strCmdKill := Format('/c taskkill /f /t /im %s', [strExeName]);
- bRes := ShellExec('open', ExpandConstant('{cmd}'), strCmdFind, '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
- if bRes then begin
- bRes := LoadStringFromFile(strTmpFile, strFileContent);
- strFileContent := Trim(strFileContent);
- if bRes then begin
- if StrToInt(strFileContent) > 0 then begin
- if MsgBox(ExpandConstant('{cm:checkSoftTip}'), mbConfirmation, MB_OKCANCEL) = IDOK then begin
- // ֹ
- ShellExec('open', ExpandConstant('{cmd}'), strCmdKill, '', SW_HIDE, ewNoWait, ErrorCode);
- Result:= true;// װ
- end else begin
- Result:= false;// װ˳
- Exit;
- end;
- end else begin
- // û
- Result:= true;
- Exit;
- end;
- end;
- end;
- Result :=true;
- end;
-
- // ʼҳһʱжǷ
- function NextButtonClick(CurPageID: Integer): Boolean;
- begin
- if 1=CurPageID then begin
- Result := KDetectSoft('{#MyAppExeName}');
- Exit;
- end;
- Result:= true;
- end;
-
- // жʱر
- function InitializeUninstall(): Boolean;
- begin
- Result := KDetectSoft('{#MyAppExeName}');
- end;
-
- // Indicates whether the specified version and service pack of the .NET Framework is installed.
- //
- // version -- Specify one of these strings for the required .NET Framework version:
- // 'v1.1' .NET Framework 1.1
- // 'v2.0' .NET Framework 2.0
- // 'v3.0' .NET Framework 3.0
- // 'v3.5' .NET Framework 3.5
- // 'v4\Client' .NET Framework 4.0 Client Profile
- // 'v4\Full' .NET Framework 4.0 Full Installation
- // 'v4.5' .NET Framework 4.5
- // 'v4.5.1' .NET Framework 4.5.1
- // 'v4.5.2' .NET Framework 4.5.2
- // 'v4.6' .NET Framework 4.6
- // 'v4.6.1' .NET Framework 4.6.1
- // 'v4.6.2' .NET Framework 4.6.2
- // 'v4.7' .NET Framework 4.7
- // 'v4.7.1' .NET Framework 4.7.1
- // 'v4.7.2' .NET Framework 4.7.2
- // 'v4.8' .NET Framework 4.8
- //
- // service -- Specify any non-negative integer for the required service pack level:
- // 0 No service packs required
- // 1, 2, etc. Service pack 1, 2, etc. required
- function IsDotNetDetected(version: string; service: cardinal): boolean;
- var
- key, versionKey: string;
- install, release, serviceCount, versionRelease: cardinal;
- success: boolean;
- begin
- versionKey := version;
- versionRelease := 0;
-
- // .NET 1.1 and 2.0 embed release number in version key
- if version = 'v1.1' then begin
- versionKey := 'v1.1.4322';
- end
- else if version = 'v2.0' then begin
- versionKey := 'v2.0.50727';
- end
-
- // .NET 4.5 and newer install as update to .NET 4.0 Full
- else if Pos('v4.', version) = 1 then begin
- versionKey := 'v4\Full';
- case version of
- 'v4.5': versionRelease := 378389;
- 'v4.5.1': versionRelease := 378675; // 378758 on Windows 8 and older
- 'v4.5.2': versionRelease := 379893;
- 'v4.6': versionRelease := 393295; // 393297 on Windows 8.1 and older
- 'v4.6.1': versionRelease := 394254; // 394271 on Windows 8.1 and older
- 'v4.6.2': versionRelease := 394802; // 394806 on Windows 8.1 and older
- 'v4.7': versionRelease := 460798; // Windows 10
- 'v4.7.1': versionRelease := 461308; // Windows 10
- 'v4.7.2': versionRelease := 461808; // Windows 10
- 'v4.8' : versionRelease := 528040; // Windows 10
- end;
- end;
-
- // installation key group for all .NET versions
- key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + versionKey;
-
- // .NET 3.0 uses value InstallSuccess in subkey Setup
- if Pos('v3.0', version) = 1 then begin
- success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
- end else begin
- success := RegQueryDWordValue(HKLM, key, 'Install', install);
- end;
-
- // .NET 4.0 and newer use value Servicing instead of SP
- if Pos('v4', version) = 1 then begin
- success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
- end else begin
- success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
- end;
-
- // .NET 4.5 and newer use additional value Release
- if versionRelease > 0 then begin
- success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
- success := success and (release >= versionRelease);
- end;
-
- result := success and (install = 1) and (serviceCount >= service);
- end;
-
- function InitializeSetup: Boolean;
- var Path:string;
- ResultCode: Integer;
- begin
- if IsDotNetDetected('v4.5.2', 0) then
- begin
- if RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{01FAEC41-B3BC-44F4-B185-5E8475AEB855}', 'Version') then
- begin
- Result := true;
- end
- else
- begin
- if MsgBox('ϵͳûаװVC++Ƿزװ', mbConfirmation, MB_YESNO) = idYes then
- begin
- Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');
- Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/VC_redist.x86.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
- MsgBox('밲װVC++бװ',mbInformation,MB_OK);
- Result := false;
- end
- else
- begin
- MsgBox('ȡֶװVC2015-2019',mbInformation,MB_OK);
- Result := true;
- end;
- end;
- end
- else
- begin
- if MsgBox('ϵͳûаװ.Net Framework4.5.2Ƿزװ', mbConfirmation, MB_YESNO) = idYes then
- begin
- Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');
- Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/NDP452-KB2901907-x86-x64-AllOS-ENU.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
- MsgBox('밲װ.Net Frameworkбװ',mbInformation,MB_OK);
- Result := false;
- end
- else
- begin
- MsgBox('ûаװ.Net Frameworkгװ˳',mbInformation,MB_OK);
- Result := false;
- end;
- end;
- end;
-
-
- [CustomMessages]
- chinesesimp.checkSoftTip=װװУ%n%n"ȷ"ֹ"ȡ"
|