阅读:4369回复:2
Inno Setup中怎样做个卸载前的显示即将卸载的程序路径的对话框
在InnoSetup中该怎么做呢?
|
|
沙发#
发布于:2012-04-01 11:15
You will need to create a custom form (CreateCustomForm()) or use a simple message box (MsgBox()) in the CurUninstallStepChanged(usUninstall) event function.
|
|
|
板凳#
发布于:2012-04-01 11:25
; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "My Program" #define MyAppVersion "1.5" #define MyAppPublisher "My Company, Inc." #define MyAppURL "http://www.example.com/" #define MyAppExeName "MyProg.exe" [Setup] ; NOTE: The value of AppId uniquely identifies this application. ; Do not use the same AppId value in installers for other applications. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) AppId={{155A0EFE-4F28-4179-849B-A7AD8F7BE671} AppName={#MyAppName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={pf}\{#MyAppName} DefaultGroupName={#MyAppName} OutputBaseFilename=setup Compression=lzma SolidCompression=yes [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon [Run] Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, "&", "&&")}}"; Flags: nowait postinstall skipifsilent [code] function AskPassword(): Boolean; var Form: TSetupForm; OKButton, CancelButton: TButton; PwdEdit: TPasswordEdit; begin Result := false; Form := CreateCustomForm(); try Form.ClientWidth := ScaleX(256); Form.ClientHeight := ScaleY(100); Form.Caption := '密码验证'; Form.BorderIcons := [biSystemMenu]; Form.BorderStyle := bsDialog; Form.Center; OKButton := TButton.Create(Form); OKButton.Parent := Form; OKButton.Width := ScaleX(75); OKButton.Height := ScaleY(23); OKButton.Left := Form.ClientWidth - ScaleX(75 + 6 + 75 + 50); OKButton.Top := Form.ClientHeight - ScaleY(23 + 10); OKButton.Caption := '确定'; OKButton.ModalResult := mrOk; OKButton.Default := true; CancelButton := TButton.Create(Form); CancelButton.Parent := Form; CancelButton.Width := ScaleX(75); CancelButton.Height := ScaleY(23); CancelButton.Left := Form.ClientWidth - ScaleX(75 + 50); CancelButton.Top := Form.ClientHeight - ScaleY(23 + 10); CancelButton.Caption := '取消'; CancelButton.ModalResult := mrCancel; CancelButton.Cancel := True; PwdEdit := TPasswordEdit.Create(Form); PwdEdit.Parent := Form; PwdEdit.Width := ScaleX(210); PwdEdit.Height := ScaleY(23); PwdEdit.Left := ScaleX(23); PwdEdit.Top := ScaleY(23); Form.ActiveControl := PwdEdit; if Form.ShowModal() = mrOk then begin Result := PwdEdit.Text = 'bw12345678'; if not Result then MsgBox('密码错误', mbInformation, MB_OK); end; finally Form.Free(); end; end; function InitializeUninstall(): Boolean; begin result:= AskPassword(); end; |
|
|