vint56
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору [Files] #include "botva2.iss" [setup] [files Source: InstallFiles\Button.png; Flags: dontcopy; DestDir: {tmp} Source: InstallFiles\botva2.dll; DestDir: {tmp}; Flags: dontcopy Source: InstallFiles\InnoCallback.dll; DestDir: {tmp}; Flags: dontcopy Source: InstallFiles\Click.wav; Flags: dontcopy; DestDir: {tmp} Source: InstallFiles\Enter.wav; Flags: dontcopy; DestDir: {tmp} [Code] var hCancelBtn, hNextBtn, hBackBtn, hDirBrowseBtn, hGroupBrowseBtn :HWND; ButtonFont: TFont; function sndPlaySound(lpszSoundName: String; uFlags: cardinal):integer; external 'sndPlaySoundA@winmm.dll stdcall'; procedure BtnEnter(hBtn:HWND); begin sndPlaySound(ExpandConstant('{tmp}\Enter.wav'), $0001); end; procedure SetStateNewButtons; begin //устанавливаем наши кнопки в тоже состояние, что и их оригиналы with WizardForm.BackButton do begin BtnSetText(hBackBtn,PAnsiChar(Caption)); BtnSetVisibility(hBackBtn,Visible); end; with WizardForm.NextButton do begin BtnSetText(hNextBtn,PAnsiChar(Caption)); BtnSetVisibility(hNextBtn,Visible); end; with WizardForm.CancelButton do begin BtnSetText(hCancelBtn,PAnsiChar(Caption)); BtnSetVisibility(hCancelBtn,Visible); end; BtnSetText(hDirBrowseBtn,PAnsiChar(WizardForm.DirBrowseButton.Caption)); BtnSetText(hGroupBrowseBtn,PAnsiChar(WizardForm.GroupBrowseButton.Caption)); end; procedure WizardFormBtnClick(hBtn:HWND); var Btn:TButton; begin sndPlaySound(ExpandConstant('{tmp}\click.wav'), $0001); //для кнопок выполняется одна процедура при нажатии, поэтому ищем, //процедуру какой оригинальной кнопки нам все-таки нужно выполнить case hBtn of hCancelBtn: Btn:=WizardForm.CancelButton; hNextBtn: Btn:=WizardForm.NextButton; hBackBtn: Btn:=WizardForm.BackButton; hDirBrowseBtn: Btn:=WizardForm.DirBrowseButton; hGroupBrowseBtn: Btn:=WizardForm.GroupBrowseButton; end; Btn.OnClick(Btn); //выполняем нажатие на стандартную кнопку SetStateNewButtons; BtnRefresh(hBtn); end; function InitializeSetup:boolean; begin if not FileExists(ExpandConstant('{tmp}\botva2.dll')) then ExtractTemporaryFile('botva2.dll'); if not FileExists(ExpandConstant('{tmp}\innocallback.dll')) then ExtractTemporaryFile('innocallback.dll'); Result:=True; end; procedure InitializeWizard; begin ExtractTemporaryFile('button.png'); ExtractTemporaryFile('click.wav'); ExtractTemporaryFile('Enter.wav'); WizardForm.BackButton.Left:=230; //используем для кнопок свой шрифт ButtonFont:=TFont.Create; with ButtonFont do begin Style:=[fsBold]; Name:='Arial' end; //заменим стандартные кнопки на свои with WizardForm.CancelButton do begin hCancelBtn:=BtnCreate(WizardForm.Handle,Left-8,Top-8,Width+16,Height+16,ExpandConstant('{tmp}\button.png'),18,False); BtnSetEvent(hCancelBtn,BtnClickEventID,WrapBtnCallback(@WizardFormBtnClick,1)); BtnSetEvent(hCancelBtn,BtnMouseEnterEventID,WrapBtnCallback(@BtnEnter,1)); BtnSetFont(hCancelBtn,ButtonFont.Handle); BtnSetFontColor(hCancelBtn,$000000,$DAE369,$DAE369,$B6B6B6); BtnSetCursor(hCancelBtn,GetSysCursorHandle(32649)); Width:=0; Height:=0; end; with WizardForm.NextButton do begin hNextBtn:=BtnCreate(WizardForm.Handle,Left-8,Top-8,Width+16,Height+16,ExpandConstant('{tmp}\button.png'),18,False); BtnSetEvent(hNextBtn,BtnClickEventID,WrapBtnCallback(@WizardFormBtnClick,1)); BtnSetEvent(hNextBtn,BtnMouseEnterEventID,WrapBtnCallback(@BtnEnter,1)); BtnSetFont(hNextBtn,ButtonFont.Handle); BtnSetFontColor(hNextBtn,$000000,$DAE369,$DAE369,$B6B6B6); BtnSetCursor(hNextBtn,GetSysCursorHandle(32649)); Width:=0; Height:=0; end; with WizardForm.BackButton do begin hBackBtn:=BtnCreate(WizardForm.Handle,Left-8,Top-8,Width+16,Height+16,ExpandConstant('{tmp}\button.png'),18,False); BtnSetEvent(hBackBtn,BtnClickEventID,WrapBtnCallback(@WizardFormBtnClick,1)); BtnSetEvent(hBackBtn,BtnMouseEnterEventID,WrapBtnCallback(@BtnEnter,1)); BtnSetFont(hBackBtn,ButtonFont.Handle); BtnSetFontColor(hBackBtn,$000000,$DAE369,$DAE369,$B6B6B6); BtnSetCursor(hBackBtn,GetSysCursorHandle(32649)); Width:=0; Height:=0; end; with WizardForm.DirBrowseButton do begin hDirBrowseBtn:=BtnCreate(WizardForm.SelectDirPage.Handle,Left-8,Top-8,Width+16,Height+16,ExpandConstant('{tmp}\button.png'),18,False); BtnSetEvent(hDirBrowseBtn,BtnClickEventID,WrapBtnCallback(@WizardFormBtnClick,1)); BtnSetEvent(hDirBrowseBtn,BtnMouseEnterEventID,WrapBtnCallback(@BtnEnter,1)); BtnSetFont(hDirBrowseBtn,ButtonFont.Handle); BtnSetFontColor(hDirBrowseBtn,$000000,$DAE369,$DAE369,$B6B6B6); BtnSetCursor(hDirBrowseBtn,GetSysCursorHandle(32649)); Width:=0; Height:=0; end; with WizardForm.GroupBrowseButton do begin hGroupBrowseBtn:=BtnCreate(WizardForm.SelectProgramGroupPage.Handle,Left-8,Top-8,Width+16,Height+16,ExpandConstant('{tmp}\button.png'),18,False); BtnSetEvent(hGroupBrowseBtn,BtnClickEventID,WrapBtnCallback(@WizardFormBtnClick,1)); BtnSetEvent(hGroupBrowseBtn,BtnMouseEnterEventID,WrapBtnCallback(@BtnEnter,1)); BtnSetFont(hGroupBrowseBtn,ButtonFont.Handle); BtnSetFontColor(hGroupBrowseBtn,$000000,$DAE369,$DAE369,$B6B6B6); BtnSetCursor(hGroupBrowseBtn,GetSysCursorHandle(32649)); Width:=0; Height:=0; end; ImgApplyChanges(WizardForm.Handle); end; Procedure CurPageChanged(CurPageID: Integer); Begin SetStateNewButtons; end; procedure DeinitializeSetup(); begin gdipShutdown; ButtonFont.Free;//прибьем свой шрифт end; |