杉宫竹苑工作室

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2703|回复: 0

仿QQ安装

[复制链接]
发表于 2018-8-12 20:08:38 | 显示全部楼层 |阅读模式

正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. ; 脚本由 Inno Setup 脚本向导 生成!
  2. ; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!

  3. #define MyAppName "RemoteCard"
  4. #define MyAppVersion "1.0"
  5. #define MyAppPublisher "RemoteCard"
  6. #define MyAppURL "http://www.example.com/"
  7. #define MyAppExeName "RemoteCard.exe"

  8. [Setup]
  9. ; 注: AppId的值为单独标识该应用程序。
  10. ; 不要为其他安装程序使用相同的AppId值。
  11. ; (生成新的GUID,点击 工具|在IDE中生成GUID。)
  12. AppId={{C19C0F44-A8D2-4863-AFAA-AED21E50C603}
  13. AppName={#MyAppName}
  14. AppVersion={#MyAppVersion}
  15. AppPublisher={#MyAppPublisher}
  16. AppPublisherURL={#MyAppURL}
  17. AppSupportURL={#MyAppURL}
  18. AppUpdatesURL={#MyAppURL}
  19. DefaultDirName={pf}\{#MyAppName}
  20. DisableProgramGroupPage=yes
  21. OutputDir=app
  22. OutputBaseFilename=RemoteCard
  23. SetupIconFile=tmp\RemoteCard.ico
  24. Compression=lzma
  25. SolidCompression=yes

  26. [Languages]
  27. Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"

  28. [Tasks]
  29. Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone; OnlyBelowVersion: 0,8.1

  30. [Files]
  31. Source: "RemoteCard.exe"; DestDir: "{app}"; Flags: ignoreversion
  32. Source: "jre\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
  33. Source: "tmp\*"; DestDir: "{tmp}"; Flags: dontcopy solidbreak ; Attribs: hidden system
  34. ; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”

  35. [Icons]
  36. //开始菜单快捷方式
  37. Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
  38. //桌面快捷方式
  39. Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
  40. //开始菜单卸载程序
  41. Name: {commonprograms}\卸载 {#MyAppName}; Filename:{uninstallexe}; WorkingDir: {app};


  42. [Run]
  43. Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent


  44. [code]
  45. #include  'dll.iss'


  46. var
  47.   label2,label3:TLabel;
  48.   BGimg:longint;
  49.   btn_next,licenseBtn,MinBtn,CancelBtn,btn_cancel,btn_Browser,btn_setup,dirback,btnBack:HWND;
  50.   pathEdit:tedit;
  51.   licenseImg,progressbgImgbk,progressbgImg,PBOldProc:longint;
  52.   Timer1: TTimer;
  53.   licenseCheck:HWND;
  54.   licenseRich:TRichEditViewer;

  55. Function desktop(): Boolean;
  56. begin
  57.   Result :=true;
  58. end;


  59. procedure btn_cancelclick(hBtn:HWND);
  60. begin
  61. WizardForm.CancelButton.Click;
  62. end;

  63.   //浏览选择安装目录按钮
  64. procedure btn_Browserclick(hBtn:HWND);
  65. begin
  66.   WizardForm.DirBrowseButton.Click;
  67.   pathEdit.text := WizardForm.DirEdit.text;
  68. end;

  69. //返回按钮
  70. procedure dirbackclick(hBtn:HWND);
  71. begin
  72.   WizardForm.BackButton.Click;
  73.   label2.Show;
  74.   licenseRich.Height:=0;
  75.   ImgSetVisibility(BGimg,false);
  76.   BGimg:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg1.png'),0,0,590,300,false,true);
  77.   ImgApplyChanges(WizardForm.Handle);
  78.   label3.Hide;
  79.   pathEdit.Hide;
  80.   BtnSetVisibility(btn_Browser,false);
  81.   BtnSetVisibility(btn_setup,false);
  82.   BtnSetVisibility(dirback,false);
  83.   BtnSetVisibility(licenseCheck,true);
  84.   BtnSetVisibility(licenseBtn,true);
  85.   BtnSetVisibility(btn_next,true);
  86. end;

  87. //立即安装按钮
  88. procedure btn_setupclick(hBtn:HWND);
  89. begin
  90.   WizardForm.NextButton.Click;

  91.   WizardForm.NextButton.Click;
  92. end;

  93. procedure pathEditChange(Sender: TObject);
  94. begin
  95.   WizardForm.DirEdit.text:=pathEdit.Text ;
  96. end;

  97. //下一步按钮
  98. procedure btn_nextclick(hBtn:HWND);
  99. begin
  100.   WizardForm.NextButton.Click;
  101.   licenseRich.Height:=0;
  102.   ImgSetVisibility(BGimg,false);
  103.   BGimg:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\chcek_dir.png'),0,0,590,100,false,true);
  104.   ImgApplyChanges(WizardForm.Handle);
  105.   label3.Show;
  106.   label2.Hide;
  107.   label3.Caption:='安装位置';
  108.   pathEdit.show;
  109.   BtnSetVisibility(btn_Browser,true);
  110.   BtnSetVisibility(btn_setup,true);
  111.   BtnSetVisibility(dirback,true);
  112.   BtnSetVisibility(licenseCheck,false)
  113.   BtnSetVisibility(licenseBtn,false)
  114.   BtnSetVisibility(btn_next,false)
  115. end;

  116. //用户协议的勾选框
  117. procedure check_licenseclick(hBtn:HWND);
  118. begin
  119.     if BtnGetChecked(licenseCheck)=true then
  120.     begin
  121.        BtnSetEnabled(btn_next,true)
  122.     end
  123.     else
  124.     begin
  125.        BtnSetEnabled(btn_next,false)
  126.     end
  127. end;

  128.   //点击阅读协议按钮
  129. procedure locklicenseclick(hBtn:HWND);
  130. begin
  131.   label2.Hide;
  132.   licenseRich.Height:=250
  133.   ImgSetVisibility(BGimg,false);
  134.   BGimg:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg_license.png'),0,0,590,100,false,true);
  135.   ImgApplyChanges(WizardForm.Handle);
  136.   BtnSetVisibility(licenseCheck,false)
  137.   BtnSetVisibility(licenseBtn,false)
  138.   BtnSetVisibility(btn_next,false)
  139.   BtnSetVisibility(btn_setup,false)
  140.   BtnSetVisibility(dirback,true);
  141. end;

  142. //进度条
  143. function PBProc(h:hWnd;Msg,wParam,lParam:Longint):Longint;
  144. var
  145.   pr,i1,i2 : Extended;
  146.   w : integer;
  147. begin
  148.   Result:=CallWindowProc(PBOldProc,h,Msg,wParam,lParam);
  149.   if (Msg=$402) and (WizardForm.ProgressGauge.Position>WizardForm.ProgressGauge.Min) then
  150.   begin
  151.     i1:=WizardForm.ProgressGauge.Position-WizardForm.ProgressGauge.Min;
  152.     i2:=WizardForm.ProgressGauge.Max-WizardForm.ProgressGauge.Min;
  153.     pr:=i1*100/i2;
  154.     w:=Round(530*pr/100);
  155.     ImgSetPosition(progressbgImg,30,195,w,15);
  156.     ImgSetVisiblePart(progressbgImg,30,0,w,15);
  157.     ImgApplyChanges(WizardForm.Handle);
  158.   end;
  159. end;

  160. procedure InitializeWizard();
  161. begin
  162.   WizardForm.OuterNotebook.hide;
  163.   WizardForm.Bevel.Hide;
  164.   WizardForm.Position:=poDesktopCenter;
  165.   WizardForm.Width:=590;
  166.   WizardForm.Height:=475;
  167.   WizardForm.Color:=clWhite ;

  168.   ExtractTemporaryFile('bg1.png');
  169.   ExtractTemporaryFile('btn_next.png');
  170.   ExtractTemporaryFile('checkbox.png');
  171.   ExtractTemporaryFile('license.png');

  172.   ExtractTemporaryFile('chcek_dir.png');
  173.   ExtractTemporaryFile('btn_Browser.png');
  174.   ExtractTemporaryFile('back.png');
  175.   ExtractTemporaryFile('btn_steup.png');

  176.   ExtractTemporaryFile('bg_license.png');
  177.   ExtractTemporaryFile('license.rtf');

  178.   ExtractTemporaryFile('loading_pic.png');
  179.   ExtractTemporaryFile('btn_cancel.png');
  180.   ExtractTemporaryFile('loading.png');

  181.   ExtractTemporaryFile('btn_complete.png');
  182.   ExtractTemporaryFile('finish_bg.png');

  183.   //浏览按钮
  184.   btn_Browser:=BtnCreate(WizardForm.Handle,480,180,80,31,ExpandConstant('{tmp}\btn_Browser.png'),1,false)
  185.   BtnSetEvent(btn_Browser,BtnClickEventID,WrapBtnCallback(@btn_Browserclick,1));
  186.   BtnSetVisibility(btn_Browser,false);

  187.   //返回按钮
  188.   dirback:=BtnCreate(WizardForm.Handle,490,385,68,29,ExpandConstant('{tmp}\back.png'),1,false)
  189.   BtnSetEvent(dirback,BtnClickEventID,WrapBtnCallback(@dirbackclick,1));
  190.   BtnSetVisibility(dirback,false);

  191.   //立即安装
  192.   btn_setup:=BtnCreate(WizardForm.Handle,400,385,80,29,ExpandConstant('{tmp}\btn_steup.png'),2,false)
  193.   BtnSetEvent(btn_setup,BtnClickEventID,WrapBtnCallback(@btn_setupclick,1));
  194.   BtnSetVisibility(btn_setup,false);

  195.   //取消
  196.   btn_cancel:=BtnCreate(WizardForm.Handle,490,380,68,29,ExpandConstant('{tmp}\btn_cancel.png'),2,false)
  197.   BtnSetEvent(btn_cancel,BtnClickEventID,WrapBtnCallback(@btn_cancelclick,1));
  198.   BtnSetVisibility(btn_cancel,false);

  199.   //许可协议勾选框
  200.   licenseCheck:=BtnCreate(WizardForm.Handle,30,375,15,15,ExpandConstant('{tmp}\checkbox.png'),1,true)
  201.   BtnSetEvent(licenseCheck,BtnClickEventID,WrapBtnCallback(@check_licenseclick,1));
  202.   BtnSetChecked(licenseCheck,true);

  203.   //阅读许可协议
  204.   licenseBtn:=BtnCreate(WizardForm.Handle,200,377,86,12,ExpandConstant('{tmp}\license.png'),1,false)
  205.   BtnSetEvent(licenseBtn,BtnClickEventID,WrapBtnCallback(@locklicenseclick,1));

  206.    //下一步
  207.   btn_next:=BtnCreate(WizardForm.Handle,490,369,68,29,ExpandConstant('{tmp}\btn_next.png'),1,false)
  208.   BtnSetEvent(btn_next,BtnClickEventID,WrapBtnCallback(@btn_nextclick,4));

  209.   label2:= TLabel.Create(WizardForm);
  210.   with label2 do
  211.   begin
  212.   Parent := WizardForm;
  213.   Caption := '我已阅读同意EIP7远程打卡';
  214.   Font.Size:=9;
  215.   Font.Name:='微软雅黑'
  216.   Color := $00666666
  217.   Transparent := TRUE;
  218.   SetBounds(52 ,375,200,20)
  219.   end;

  220.   //安装过程中的提示
  221.   label3:= TLabel.Create(WizardForm);
  222.   with label3 do
  223.   begin
  224.   Parent := WizardForm;
  225.   Caption := '';
  226.   Font.Size:=12;
  227.   Font.Name:='微软雅黑'
  228.   Color := $00666666
  229.   Transparent := TRUE;
  230.   SetBounds(30 ,145,200,20)
  231.   end;

  232.   //安装路径,默认不显示
  233.   pathEdit:= TEdit.Create(WizardForm);
  234.   with pathEdit do
  235.   begin
  236.     Parent := WizardForm;
  237.     text :=WizardForm.DirEdit.text;
  238.     Font.Name:='微软雅黑'
  239.     Font.Color:=$00666666
  240.     SetBounds(30,181,440,35);
  241.     OnChange:=@pathEditChange;
  242.     Color := $00ffffff
  243.     TabStop :=false;
  244.      Font.Size:=12;
  245.   end;
  246.   pathEdit.Hide;
  247.   pathEdit.AutoSelect:=true;

  248.    //加载许可协议
  249.   licenseRich:= TRichEditViewer.Create(WizardForm);
  250.   with licenseRich do
  251.   begin
  252.   Parent := WizardForm;
  253.   ReadOnly:= true;
  254.   SCROLLBARS:= ssVertical;
  255.   font.Name:='微软雅黑'
  256.   Color:=clWhite;
  257.   SetBounds(30,120,530,250)
  258.   Lines.LoadFromFile(ExpandConstant('{tmp}\license.rtf'));
  259.   TabStop:=false;
  260.   Height := 0;
  261.   end;


  262.   PBOldProc:=SetWindowLong(WizardForm.ProgressGauge.Handle,-4,PBCallBack(@PBProc,4));
  263.   Timer1 := TTimer.Create(WizardForm);
  264. end;


  265. //该过程在安装终止时被调用,注意及时在用户没有安装任何文件之前退出也会被调用。
  266. procedure DeinitializeSetup();
  267. begin
  268.   gdipShutdown;
  269. end;


  270. procedure CurPageChanged(CurPageID: Integer);
  271. begin
  272.   //把原始的按钮屏蔽掉
  273.   WizardForm.NextButton.Visible:=false;
  274.   WizardForm.CancelButton.Height:=0;
  275.   WizardForm.BackButton.Height:=0;

  276.    //进入安装界面
  277.   if CurPageID=wpWelcome then
  278.   begin

  279.    WizardForm.NextButton.Click;
  280.    //背景图片
  281.   BGimg:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg1.png'),0,0,590,314,false,true);
  282.   WizardForm.Width:=590;
  283.   WizardForm.Show;
  284.   end

  285.   //正在安装
  286.   if CurPageID = wpInstalling then
  287.   begin
  288.   pathEdit.Hide;
  289.   BtnSetVisibility(btn_Browser,false)
  290.   WizardForm.Height:=460
  291.   BtnSetVisibility(dirback,false)
  292.   BtnSetVisibility(licenseBtn,false);
  293.   BtnSetVisibility(licenseCheck,false);
  294.   BtnSetVisibility(btn_cancel,true);
  295.   ImgSetVisibility(BGimg,false);
  296.   BGimg:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\loading_pic.png'),0,0,590,105,false,true);
  297.   progressbgImg:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\loading.png'),30,195,0,0,True,True);
  298.   BtnSetVisibility(btn_setup,false);
  299.   label2.Hide;
  300.   label3.Show;
  301.   label3.Caption:='正在安装...';
  302.   label3.SetBounds(30,145,200,20);
  303.   label3.Font.Size:=16;
  304.   Timer1.Interval:=500;
  305.   end

  306.   //安装完成
  307.   if CurPageID = wpFinished then
  308.   begin
  309.   Timer1.Interval:=0
  310.   ImgSetVisibility(progressbgImgbk,false)
  311.   ImgSetVisibility(progressbgImg,false)
  312.   btn_setup:=BtnCreate(WizardForm.Handle,180,354,230,47,ExpandConstant('{tmp}\btn_complete.png'),2,false)
  313.   BtnSetEvent(btn_setup,BtnClickEventID,WrapBtnCallback(@btn_setupclick,1));
  314.   BGimg:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\finish_bg.png'),0,0,590,315,false,true);
  315.   label3.Hide;
  316.   label2.Hide;
  317.   BtnSetVisibility(btn_cancel,false);
  318.   end

  319.   ImgApplyChanges(WizardForm.Handle)
  320. end;

  321. function ShouldSkipPage(PageID: Integer): Boolean;
  322. begin
  323.     if (PageID=wpSelectComponents)  then    //跳过组件安装界面
  324.     result := true;
  325. end;


复制代码
全额附件下载
游客,本帖隐藏的内容需要积分高于 500 才可浏览,您当前积分为 0


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SgzyStudio

GMT+8, 2024-7-16 16:38 , Processed in 0.116962 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表