Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.26 KB | None | 0 0
  1. #include "Musicbotva2.iss"
  2. #include "MusicBASS_Module.iss"
  3. [Code]
  4. function ShellExecute(hwnd: HWND; lpOperation: string; lpFile: string;
  5. lpParameters: string; lpDirectory: string; nShowCmd: Integer): THandle;
  6. external 'ShellExecuteW@shell32.dll stdcall';
  7.  
  8. var
  9. LanguageForm: TSetupForm;
  10. SelectLabel: TNewStaticText;
  11. CancelButton: TNewButton;
  12.  
  13. procedure LangChange(Sender : TObject);
  14. begin
  15. case TNewComboBox(Sender).ItemIndex of
  16. 0: { English }
  17. begin
  18. SelectLabel.Caption := 'Select the language to the installation:';
  19. CancelButton.Caption := 'Cancel';
  20. LanguageForm.Caption := 'Party Hard 1.4.5 (nizcoz)';
  21. end;
  22. 1: { Español }
  23. begin
  24. SelectLabel.Caption := 'Selecciona el idioma de la instalación:';
  25. CancelButton.Caption := 'Cancelar';
  26. LanguageForm.Caption := 'Party Hard 1.4.5 (nizcoz)';
  27. end;
  28. end;
  29. end;
  30.  
  31. procedure SelectLanguage();
  32. var
  33. OKButton: TNewButton;
  34. LangCombo: TNewComboBox;
  35. Languages: TStrings;
  36. Params: string;
  37. Instance: THandle;
  38. P, I: Integer;
  39. S, L: string;
  40. begin
  41. Languages := TStringList.Create();
  42.  
  43. Languages.Add('eng=English');
  44. Languages.Add('spa=Español');
  45.  
  46. LanguageForm := CreateCustomForm;
  47.  
  48. LanguageForm.Caption := SetupMessage(msgSelectLanguageTitle);
  49. LanguageForm.ClientWidth := ScaleX(240);
  50. LanguageForm.ClientHeight := ScaleY(125);
  51. LanguageForm.BorderStyle := bsDialog;
  52. LanguageForm.Center;
  53.  
  54. CancelButton := TNewButton.Create(LanguageForm);
  55. CancelButton.Parent := LanguageForm;
  56. CancelButton.Left := ScaleX(140);
  57. CancelButton.Top := ScaleY(93);
  58. CancelButton.Width := ScaleY(90);
  59. CancelButton.Height := ScaleY(23);
  60. CancelButton.TabOrder := 3;
  61. CancelButton.ModalResult := mrCancel;
  62. CancelButton.Caption := SetupMessage(msgButtonCancel);
  63.  
  64. OKButton := TNewButton.Create(LanguageForm);
  65. OKButton.Parent := LanguageForm;
  66. OKButton.Left := ScaleX(10);
  67. OKButton.Top := ScaleY(93);
  68. OKButton.Width := ScaleX(90);
  69. OKButton.Height := ScaleY(23);
  70. OKButton.Caption := SetupMessage(msgButtonOK);
  71. OKButton.Default := True
  72. OKButton.ModalResult := mrOK;
  73. OKButton.TabOrder := 2;
  74.  
  75. LangCombo := TNewComboBox.Create(LanguageForm);
  76. LangCombo.Parent := LanguageForm;
  77. LangCombo.Left := ScaleX(16);
  78. LangCombo.Top := ScaleY(56);
  79. LangCombo.Width := ScaleX(206);
  80. LangCombo.Height := ScaleY(21);
  81. LangCombo.Style := csDropDownList;
  82. LangCombo.DropDownCount := 16;
  83. LangCombo.TabOrder := 1;
  84.  
  85. SelectLabel := TNewStaticText.Create(LanguageForm);
  86. SelectLabel.Parent := LanguageForm;
  87. SelectLabel.Left := ScaleX(16);
  88. SelectLabel.Top := ScaleY(15);
  89. SelectLabel.Width := ScaleX(273);
  90. SelectLabel.Height := ScaleY(39);
  91. SelectLabel.AutoSize := False
  92. SelectLabel.Caption := SetupMessage(msgSelectLanguageLabel);
  93. SelectLabel.TabOrder := 0;
  94. SelectLabel.WordWrap := True;
  95.  
  96. for I := 0 to Languages.Count - 1 do
  97. begin
  98. P := Pos('=', Languages.Strings[I]);
  99. L := Copy(Languages.Strings[I], 0, P - 1);
  100. S := Copy(Languages.Strings[I], P + 1, Length(Languages.Strings[I]) - P);
  101. LangCombo.Items.Add(S);
  102. if L = ActiveLanguage then
  103. LangCombo.ItemIndex := I;
  104. LangCombo.OnChange := @LangChange;
  105. end;
  106.  
  107. if LanguageForm.ShowModal = mrOK then
  108. begin
  109. // Collect current instance parameters
  110. for I := 1 to ParamCount do
  111. begin
  112. S := ParamStr(I);
  113. // Unique log file name for the elevated instance
  114. if CompareText(Copy(S, 1, 5), '/LOG=') = 0 then
  115. begin
  116. S := S + '-localized';
  117. end;
  118. // Do not pass our /SL5 switch
  119. if CompareText(Copy(S, 1, 5), '/SL5=') <> 0 then
  120. begin
  121. Params := Params + AddQuotes(S) + ' ';
  122. end;
  123. end;
  124.  
  125. L := Languages.Strings[LangCombo.ItemIndex];
  126. P := Pos('=', L);
  127. L := Copy(L, 0, P-1);
  128.  
  129. // ... and add selected language
  130. Params := Params + '/LANG=' + L;
  131.  
  132. Instance := ShellExecute(0, '', ExpandConstant('{srcexe}'), Params, '', SW_SHOW);
  133. if Instance <= 32 then
  134. begin
  135. MsgBox(
  136. Format('Running installer with selected language failed. Code: %d', [Instance]),
  137. mbError, MB_OK);
  138. end;
  139. end;
  140. end;
  141. function InitializeSetup(): Boolean;
  142. var
  143. Language: string;
  144. begin
  145. Result := True;
  146. Language := ExpandConstant('{param:LANG}');
  147. if Language = '' then
  148. begin
  149. Log('No language specified, showing language dialog');
  150. SelectLanguage();
  151. Result := False;
  152. Exit;
  153. end
  154. else
  155. begin
  156. Log('Language specified, proceeding with installation');
  157. end;
  158. end;
  159. procedure RedesignWizardForm;
  160. begin
  161. with WizardForm do
  162. begin
  163. BorderIcons:=[];
  164. Bevel1.Hide;
  165. AutoScroll := False;
  166. ClientHeight := ScaleY(349);
  167. end;
  168.  
  169. with WizardForm.CancelButton do
  170. begin
  171. Top := ScaleY(319);
  172. end;
  173.  
  174. with WizardForm.NextButton do
  175. begin
  176. Top := ScaleY(319);
  177. end;
  178.  
  179. with WizardForm.BackButton do
  180. begin
  181. Top := ScaleY(319);
  182. end;
  183.  
  184. with WizardForm.WizardBitmapImage do
  185. begin
  186. Width := ScaleX(500);
  187. end;
  188.  
  189. with WizardForm.WelcomeLabel2 do
  190. begin
  191. Visible := False;
  192. end;
  193.  
  194. with WizardForm.WelcomeLabel1 do
  195. begin
  196. Visible := False;
  197. end;
  198.  
  199. with WizardForm.WizardSmallBitmapImage do
  200. begin
  201. Left := ScaleX(0);
  202. Width := ScaleX(500);
  203. Height := ScaleY(60);
  204. end;
  205.  
  206. with WizardForm.PageDescriptionLabel do
  207. begin
  208. Visible := False;
  209. end;
  210.  
  211. with WizardForm.PageNameLabel do
  212. begin
  213. Visible := False;
  214. end;
  215.  
  216. with WizardForm.WizardBitmapImage2 do
  217. begin
  218. Width := ScaleX(500);
  219. ExtractTemporaryFile('WizardForm.WizardBitmapImage2.bmp');
  220. Bitmap.LoadFromFile(ExpandConstant('{tmp}WizardForm.WizardBitmapImage2.bmp'));
  221. end;
  222.  
  223. with WizardForm.FinishedLabel do
  224. begin
  225. Visible := False;
  226. end;
  227.  
  228. with WizardForm.FinishedHeadingLabel do
  229. begin
  230. Visible := False;
  231. end;
  232. end;
  233. procedure InitializeWizard1();
  234. begin
  235.  
  236. RedesignWizardForm;
  237. WizardForm.DiskSpaceLabel.Visible := False;
  238. end;
  239. procedure InitializeWizard2();
  240. begin
  241. ExtractTemporaryFile('BASS.dll');
  242. ExtractTemporaryFile('CallbackCtrl.dll');
  243. ExtractTemporaryFile('botva2.dll');
  244. ExtractTemporaryFile('MusicButton.png');
  245. ExtractTemporaryFile('Music.mp3');
  246.  
  247. BASS_Init('{tmp}Music.mp3')
  248. BASS_CreateOnOffButton(WizardForm, '{tmp}MusicButton.png', 20, 320, 36, 36, 4)
  249. end;
  250.  
  251. procedure InitializeWizard();
  252. begin
  253. InitializeWizard1();
  254. InitializeWizard2();
  255. end;
  256. procedure DeinitializeSetup();
  257. begin
  258. BASS_DeInit; //Îñâîáîæäàåì ïðîöåññ
  259. gdipShutdown
  260. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement