|
软件安装需要VC++2008运行库,必须要在注册DLL控件之前安装运行库,否则没有运行库DLL控件注册失败,32位跟64位系统分别要对应版本的运行库,如32位的要32位的VC++ 2008 ,64位系统需要64位的VC++ 2008的同时也要32位的VC++ 软件才可以运行,在32位系统下可以实现在注册DLL前安装运行库,64位系统好像执行不了,请老虎版主帮我看看!代码如下: - [Files]
- Source: vcredist_x86.exe; DestDir: {app}\; AfterInstall: MyAfterInstall('{app}\vcredist.exe')
- Source: vcredist_x64.exe; DestDir: {app}\; Check: IsWin64; AfterInstall: MyAfterInstall('{app}\vcredist.exe'); Tasks: ; Flags: deleteafterinstall
- [Dirs]
- Name: {code:GetDataDir}; Flags: uninsneveruninstall; Tasks:
- [Code]
- var
- DataDirPage: TInputDirWizardPage;
- procedure InitializeWizard1;
- begin
- WizardForm.BORDERICONS := [biHelp, biSystemMenu, biMinimize];//去除关于安装程序
- WizardForm.WizardSmallBitmapImage.width := 202;//右上角图片宽度
- Wizardform.WizardSmallBitmapImage.left := WizardForm.width - 205;//右上角图片位置
- Wizardform.PageNameLabel.width := 415 - 110 - 36;//这儿必须定义,数值根据图片宽度更改,显示软件名称的位置
- Wizardform.PageDescriptionLabel.width := 415 - 110 - 42;//显示页面信息的位置
- // 不显示安装类型,相应地调整组件列表框的大小
- WizardForm.TYPESCOMBO.Visible:= false;
- WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height + WizardForm.ComponentsList.Top - WizardForm.TYPESCOMBO.Top;
- WizardForm.ComponentsList.Top := WizardForm.TYPESCOMBO.Top;
- { 创建页面 }
- DataDirPage := CreateInputDirPage(wpSelectDir,
- '选择花样存放目录', '您要将花样设计文件存放在哪里?',//页面显示文字
- '选择花样设计文件存放目录.然后单击“下一步”继续. (花版存放目录不建议设置在系统盘)',//页面显示文字
- False, '');
- DataDirPage.Add('');
- { 设置默认值,如果可能则使用先前数值 (reg:HKLM\SOFTWARE\Wilcom\Wilcom ES\9.0S,Work)为获取先前安装数据目录 }
- DataDirPage.Values[0] := ExpandConstant('{reg:HKCU\SOFTWARE\Wilcom\Wilcom EmbroideryStudio\2.0Q,Work}');
- end;
- //获取先前数据目录
- procedure RegisterPreviousData1(PreviousDataKey: Integer);
- begin
- { Store the settings so we can restore them next time }
- SetPreviousData(PreviousDataKey, 'DataDir', DataDirPage.Values[0]);
- end;
- //设置默认数据目录
- function NextButtonClick1(CurPageID: Integer): Boolean;
- begin
- { Validate certain pages before allowing the user to proceed }
- begin
- if DataDirPage.Values[0] = '' then
- DataDirPage.Values[0] := 'C:\电脑花样';//数据目录
- Result := True;
- end;
- end;
- function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
- MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
- var
- S: String;
- begin
- S := S + MemoDirInfo + NewLine;//准备安装页面显示文字
- S := S + Space + DataDirPage.Values[0] + '(花版存放目录)' + NewLine;//准备安装页面显示文字
- S := S + MemoGroupInfo + NewLine;//准备安装页面显示文字
- S := S + MemoTasksInfo + NewLine;
- Result := S;
- end;
- function GetDataDir(Param: String): String;
- begin
- { Return the selected DataDir }
- Result := DataDirPage.Values[0];
- end;
- //删除所有配置文件以达到干净卸载的目的
- procedure CurUninstallStepChanged1(CurUninstallStep: TUninstallStep);
- begin
- if CurUninstallStep = usUninstall then
- if MsgBox('您是否要删除 Wilcom ES Designer 2006 运行时产生的花样自动备份文件( 位于安装目录下BACKUP文件夹)?', mbConfirmation, MB_YESNO) = IDYES then
- //删除 {app} 文件夹及其中所有文件
- DelTree(ExpandConstant('{app}\EmbroideryStudio_e2.0\BACKUP'), True, True, True);
- end;
- procedure MyAfterInstall(FileName: String);
- var
- ResultCode: Integer;
- begin
- Exec(ExpandConstant('{app}\vcredist.exe'), '/Q', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
- end;
- Var
- P1, P2: Integer;
- function TmpPassword: String;
- begin
- Result := chr(ord('2')-1);
- Result := Result + chr(ord('3')-1);
- Result := Result + chr(ord('4')-1);
- Result := Result + chr(ord('5')-1);
- Result := Result + chr(ord('6')-1);
- Result := Result + chr(ord('7')-1);
- Result := Result + chr(ord('b')-1);
- Result := Result + chr(ord('c')-1);
- Result := Result + chr(ord('d')-1);
- Result := Result + chr(ord('e')-1);
- Result := Result + chr(ord('f')-1);
- Result := Result + chr(ord('g')-1);
- end;
- function CheckPassword(Password: String): Boolean;
- begin
- Result := True;
- end;
- function GetPassword(PrePassword: String): String;
- begin
- if (P1 = 5) and (P2 = 6) then
- begin
- Result := chr(ord('2')-1);
- Result := Result + chr(ord('3')-1);
- Result := Result + chr(ord('4')-1);
- Result := Result + chr(ord('5')-1);
- Result := Result + chr(ord('6')-1);
- Result := Result + chr(ord('7')-1);
- end else
- if (P1 = 5) and (P2 = 9) then
- begin
- Result := Copy(PrePassword, 1, 6) + chr(ord('b')-1);
- Result := Result + chr(ord('c')-1);
- Result := Result + chr(ord('d')-1);
- Result := Result + chr(ord('e')-1);
- Result := Result + chr(ord('f')-1);
- Result := Result + chr(ord('g')-1);
- end else
- Result := PrePassword + 'FakePassword'; // 凡是未符合要求的一律返回假密码。
- P2 := P2 + 1;
- // MsgBox(PrePassword+' , '+Result, mbInformation, MB_OK);
- end;
- procedure InitializeWizard2();
- begin
- P1 := 5;
- {
- SetPassword(TmpPassword);
- ExtractTemporaryFile('logo.gif');
- SetPassword('FakePassword'); // 用完后最好重新清空一下密码。
- }
- end;
- procedure InitializeWizard();
- begin
- InitializeWizard1();
- InitializeWizard2();
- end;
- procedure RegisterPreviousData(PreviousDataKey: Integer);
- begin
- RegisterPreviousData1(PreviousDataKey);
- end;
- function NextButtonClick(CurPageID: Integer): Boolean;
- begin
- Result := NextButtonClick1(CurPageID); if not Result then exit;
- end;
- procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
- begin
- CurUninstallStepChanged1(CurUninstallStep);
- end;
|