ExtendExample.iss 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. ; -- ExtendExample.iss --
  2. ;
  3. ;部份扩展的脚本功能示例
  4. [Setup]
  5. AppName=My Program
  6. AppVerName=My Program version 1.5
  7. DefaultDirName={pf}\My Program
  8. DefaultGroupName=My Program
  9. UninstallDisplayIcon={app}\MyProg.exe
  10. OutputDir=userdocs:Inno Setup Examples Output
  11. [Types]
  12. Name: full; Description: Full installation
  13. Name: compact; Description: Compact installation
  14. Name: custom; Description: Custom installation; Flags: iscustom
  15. [Components]
  16. Name: program; Description: Program Files; Types: full compact custom; Flags: fixed
  17. Name: help; Description: Help File; Types: full
  18. Name: readme; Description: Readme File; Types: full
  19. Name: readme\en; Description: English; Flags: exclusive
  20. Name: readme\de; Description: German; Flags: exclusive
  21. [Files]
  22. Source: compiler:MyProg.exe; DestDir: {app}; Components: program
  23. Source: compiler:MyProg.chm; DestDir: {app}; Components: help
  24. Source: compiler:Readme.txt; DestDir: {app}; Components: readme\en; Flags: isreadme
  25. Source: compiler:Readme-German.txt; DestName: Liesmich.txt; DestDir: {app}; Components: readme\de; Flags: isreadme
  26. [Icons]
  27. Name: {group}\My Program; Filename: {app}\MyProg.exe
  28. [Code]
  29. function ClientToScreen(hWnd: HWND; var lpPoint: TPoint): Boolean;
  30. external 'ClientToScreen@user32.dll stdcall';
  31. Const
  32. ReCount = 5;
  33. MenuCount = 6;
  34. var
  35. RemarkList:array[0..ReCount - 1] of string;
  36. WebButton: TButton;
  37. PM: TPopupMenu;
  38. MenuCaptions: Array[0..MenuCount - 1] of String;
  39. MenuTexts: Array[0..MenuCount - 1] of String;
  40. Info: TNewStaticText;
  41. InfoCaption: TNewStaticText;
  42. InfoPanel: TPanel;
  43. TranPanel: TNewTranPanel; //透明Panel
  44. ChkBox:TCheckBox;
  45. Lb1: TLabel;
  46. // 以下是点击“主页”按钮后的响应函数
  47. procedure WebButtonOnClick(Sender: TObject);
  48. var
  49. P:TPoint;
  50. begin
  51. P.X := -1;
  52. P.Y := -1;
  53. ClientToScreen(WebButton.Handle, P);
  54. PM.Popup(P.X + 2, P.Y + 2);
  55. end;
  56. //以下是点击“菜单”项的事件函数
  57. procedure PopupMenuOnClick(Sender: TObject);
  58. var
  59. ErrorCode: Integer;
  60. begin
  61. ShellExec('', MenuTexts[TMenuItem(Sender).Tag], '', '', SW_SHOW, ewNoWait, ErrorCode);
  62. end;
  63. procedure OnComponentsListMouseMove(Sender:Tobject;Shift: TShiftState; X, Y: Integer);
  64. var
  65. Index: Integer;
  66. begin
  67. Index := WizardForm.ComponentsList.ItemAtPos(Point(X, Y), True);
  68. if index = - 1 then Exit;
  69. Info.Caption := RemarkList[index];
  70. end;
  71. procedure OnChkBoxClick(Sender: Tobject);
  72. Begin
  73. TranPanel.Transparent := ChkBox.Checked;
  74. End;
  75. procedure OnWizardBitmapImageClick(Sender: Tobject);
  76. Begin
  77. MsgBox('WizardBitmapImage 支持单击事件演示', mbInformation, MB_OK);
  78. End;
  79. procedure InitializeWizard();
  80. Var
  81. Item,SubItem: TMenuItem;
  82. C, J: Integer;
  83. begin
  84. //创建“关于”按钮
  85. WebButton := TButton.Create(WizardForm);
  86. WebButton.Left := WizardForm.ClientWidth - WizardForm.CancelButton.Left - WizardForm.CancelButton.Width;
  87. WebButton.Top := WizardForm.CancelButton.Top;
  88. WebButton.Width := WizardForm.CancelButton.Width;
  89. WebButton.Height := WizardForm.CancelButton.Height;
  90. WebButton.Caption := '主页(&H)';
  91. WebButton.OnClick := @WebButtonOnClick;
  92. WebButton.Parent := WizardForm;
  93. //菜单类相关
  94. MenuCaptions[0] := 'Inno Setup 主页';
  95. MenuCaptions[1] := '枫叶在线';
  96. MenuCaptions[2] := '枫叶在线 主页';
  97. MenuCaptions[3] := '枫叶在线 论坛';
  98. MenuCaptions[4] := '枫叶在线 网盘';
  99. MenuCaptions[5] := '枫叶在线 博客';
  100. MenuTexts[0] := 'http://www.jrsoftware.org/';
  101. MenuTexts[2] := 'http://www.skygz.com/';
  102. MenuTexts[3] := 'http://bbs.skygz.com/';
  103. MenuTexts[4] := 'http://u.skygz.com/?skygz';
  104. MenuTexts[5] := 'http://blog.skygz.com/';
  105. PM := TPopupMenu.Create(WizardForm);
  106. PM.PopupOrientation := pdTop;
  107. For C := 0 To 1 do
  108. begin
  109. Item := TMenuItem.Create(WizardForm);
  110. Item.Caption := MenuCaptions[C];
  111. Item.Tag := C;
  112. If C <> 1 Then Item.OnClick := @PopupMenuOnClick;
  113. If C = 1 Then
  114. For J := 2 To MenuCount - 1 Do
  115. Begin
  116. SubItem := TMenuItem.Create(WizardForm);
  117. SubItem.Caption := MenuCaptions[J];
  118. SubItem.Tag := J;
  119. SubItem.OnClick := @PopupMenuOnClick;
  120. Item.Add(SubItem);
  121. End;
  122. PM.Items.Add(Item);
  123. end;
  124. //调整组件列表的大小
  125. WizardForm.TYPESCOMBO.Visible:= false;
  126. WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height + WizardForm.ComponentsList.Top - WizardForm.TYPESCOMBO.Top;
  127. WizardForm.ComponentsList.Top := WizardForm.TYPESCOMBO.Top;
  128. WizardForm.ComponentsList.Width := ScaleX(200);
  129. //创建一个虚拟的GroupBox
  130. InfoPanel := TPanel.Create(WizardForm);
  131. InfoPanel.Parent := WizardForm.SelectComponentsPage;
  132. InfoPanel.Caption := '';
  133. InfoPanel.Top := WizardForm.ComponentsList.Top;
  134. InfoPanel.Left := ScaleX(216);
  135. InfoPanel.Width := ScaleX(200);
  136. InfoPanel.Height := WizardForm.ComponentsList.Height;
  137. InfoPanel.BevelInner := bvRaised;
  138. InfoPanel.BevelOuter := bvLowered;
  139. InfoCaption := TNewStaticText.Create(WizardForm);
  140. InfoCaption.Parent := WizardForm.SelectComponentsPage;
  141. InfoCaption.Caption := '描述';
  142. InfoCaption.Left := ScaleX(224);
  143. InfoCaption.Top := InfoPanel.Top - ScaleY(5);
  144. InfoCaption.Font.Color := clActiveCaption;
  145. // 创建描述文字
  146. Info := TNewStaticText.Create(WizardForm);
  147. Info.Parent := InfoPanel;
  148. Info.AutoSize := False;
  149. Info.Left := ScaleX(6);
  150. Info.Width := ScaleX(188);
  151. Info.Top := ScaleY(12);
  152. Info.Height := WizardForm.ComponentsList.Height - ScaleY(18);
  153. Info.Caption := '移动你的鼠标指针到组件之上,便可见到它的描述。';
  154. Info.WordWrap := true;
  155. RemarkList[0]:='描述:主程序';
  156. RemarkList[1]:='描述:帮助文件';
  157. RemarkList[2]:='描述:说明文件';
  158. RemarkList[3]:='描述:英文';
  159. RemarkList[4]:='描述:德文';
  160. WizardForm.ComponentsList.OnMouseMove:=@OnComponentsListMouseMove;
  161. TranPanel := TNewTranPanel.Create(WizardForm);
  162. TranPanel.Parent := WizardForm.WelcomePage;
  163. TranPanel.Left := WizardForm.WizardBitmapImage.Left;
  164. TranPanel.Top := WizardForm.WizardBitmapImage.Top;
  165. TranPanel.Width := WizardForm.WizardBitmapImage.Width;
  166. TranPanel.Height := WizardForm.WizardBitmapImage.Height Div 2;
  167. ChkBox := TCheckBox.Create(WizardForm);
  168. ChkBox.Parent := TranPanel;
  169. ChkBox.Caption := '点击这里测试透明 Panel';
  170. ChkBox.Width := 150;
  171. ChkBox.Top := TranPanel.Height Div 2 - 5;
  172. ChkBox.Left := TranPanel.Width Div 2 - ChkBox.Width Div 2;
  173. ChkBox.OnClick := @OnChkBoxClick;
  174. With TLabel.Create(WizardForm) Do
  175. Begin
  176. Parent := TranPanel;
  177. Caption := '点击下面'+#13#10+'WizardBitmapImage图像'+#13#10+'测试点击事件';
  178. Top := ChkBox.Top + 30;
  179. End;
  180. WizardForm.WizardBitmapImage.OnClick := @OnWizardBitmapImageClick;
  181. end;