Inno Setup (создание инсталяционных пакетов)

Статус
В этой теме нельзя размещать новые ответы.

nik1967

Old Men
Проверенный
PlaymatE, опять же из русской справки
Скачай уже русскую справку к InnoSetup - сразу много вопросов отпадёт.
 

South

Знаток
Проверенный
Последнее редактирование:

audiofeel

Старожил
Всем привет. можно исправить вот это, нажимаешь мышкой на определенную область и все картинки исчезают ( bmp, png -creatframe, createimage) :(

 

audiofeel

Старожил
Shift85, что именно.... ссылку на скрипт в лс
Код:
#ifdef UNICODE
  #define A "W"
  type
    PChar = PAnsiChar;
#else
  #define A "A"
#endif

#include "Modules/botva2.iss"
#include "Modules/TaskBar.iss"
#include "Modules/ISDone.iss"
#include "Modules/BASS_Module.iss"

const
  FR_PRIVATE = $10;
  SC_DragMove = $F012;
  WM_SYSCOMMAND = $0112;
  SC_MINIMIZE = 61472;
  notPCFonFLY = False;

type
  TCallbackProc = function (h: hWnd; Msg, wParam, lParam: Longint): Longint;

var
  Frame: TForm;
  ButtonFont: TFont;
  ISDoneCancel: integer;
  ISDoneProgressBar: TNewProgressBar;
  WFOldProc, Wizard1, Fon, Edit, ProgressBarBkg, ProgressBarImg, PBOldProc: Longint;
  ISInit, ISDoneError, OldMinimizeAnimation: boolean;
  CancelButton, BackButton, NextButton, DirBrowseButton, GroupBrowseButton, DesktopIconCheckBox :HWND;
  ExitButton, MinButton, NoStartIconCheckBox, DirectXCheckBox, VisualCCheckBox :HWND;
  WelcomeLabel, WelcomeLabel2, SelectDir, SelectDir2, NeedInstallSizeLabel: TLabel;
  GroupEditLabel, DirEditLabel, SelectProgramGroupPage, SelectTasks, ISDoneErrorLabel : TLabel;
  NoStartIconLabel, DesktopIconLabel, DirectXLabel, VisualCLabel, FileNameLabel, UnpackingArcLabel: TLabel;

function ReleaseCapture: Longint; external 'ReleaseCapture@user32.dll stdcall';
function CallWindowProc(lpPrevWndFunc: Longint; hWnd: HWND; Msg: UINT; wParam, lParam: Longint): Longint; external 'CallWindowProc{#A}@user32.dll stdcall';
function GetClassLong(Wnd: HWnd; Index: Integer): Longint; external 'GetClassLong{#A}@user32.dll stdcall';
function SetClassLong(Wnd: HWnd; Index: Integer; NewLong: Longint): Longint; external 'SetClassLong{#A}@user32.dll stdcall';
function SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND; X, Y, cx, cy: Integer; uFlags: UINT): BOOL; external 'SetWindowPos@user32.dll stdcall';
function SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external 'SetWindowLong{#A}@user32.dll stdcall';
function mciSendString(lpstrCommand, lpstrReturnString: PAnsiChar; uReturnLength, hWndCallback: Integer): Integer; external 'mciSendString{#A}@winmm stdcall delayload';
function LoadImage(hInst: THandle; ImageName: PAnsiChar; ImageType: UINT; X, Y: Integer; Flags: UINT): THandle; external 'LoadImage{#A}@user32.dll stdcall';
function SetWindowRgn(hWnd: HWND; hRgn: LongWord; bRedraw: BOOL): Integer;  external 'SetWindowRgn@user32.dll stdcall';
function ReleaseDC(hWnd: HWND; hDC: LongWord): Integer; external 'ReleaseDC@user32.dll stdcall';
function DeleteObject(p1: LongWord): BOOL; external 'DeleteObject@gdi32.dll stdcall';
function WndProcCallBack(P:TCallbackProc;ParamCount:integer):LongWord; external 'wrapcallback@files:ISDone.dll stdcall delayload';
function AddFontResource(lpszFilename: String; fl, pdv: DWORD): Integer; external 'AddFontResourceEx{#A}@gdi32.dll stdcall';
function RemoveFontResource(lpFileName: String; fl, pdv: DWORD): BOOL; external 'RemoveFontResourceEx{#A}@gdi32.dll stdcall';

procedure SetRgn(h:HWND;FileName:String;Width,Height:integer);
var
  dc:LongWord;
  FRgn:LongWord;
  bmp:HBITMAP;
begin
  BMP := LoadImage(0,PAnsiChar(ExpandConstant('{tmp}')+'\'+FileName),0,Width,Height,$10);
  dc := GetDC(h);
  FRgn := CreateBitmapRgn(dc,bmp,$ffffff,0,0);
  SetWindowRgn(h,FRgn,True);
  ReleaseDC(h,dc);
  DeleteObject(BMP);
end;

function WFProc(h:hWnd;Msg,wParam,lParam:Longint):Longint;
begin
  if Msg=$3 then SetWindowPos(Frame.Handle,0,WizardForm.Left,WizardForm.Top,0,0,$515);
  Result := CallWindowProc(WFOldProc,h,Msg,wParam,lParam);
end;

procedure FrameMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture;
  SendMessage(WizardForm.Handle, WM_SYSCOMMAND, SC_DragMove, 0);
end;

function InitializeSetup:boolean;
begin
  ISInit := False;
  if not FileExists(ExpandConstant('{tmp}\b2p.dll'))    then ExtractTemporaryFile('b2p.dll');
  if not FileExists(ExpandConstant('{tmp}\botva2.dll')) then ExtractTemporaryFile('botva2.dll');
  if not FileExists(ExpandConstant('{tmp}\BASS.dll'))   then ExtractTemporaryFile('BASS.dll');
  Result := True;
end;

function ProgressCallback(OveralPct,CurrentPct: integer; CurrentFile, TimeStr1, TimeStr2,
  TimeStr3: PAnsiChar): longword;
begin
  if OveralPct <= 1000 then
    ISDoneProgressBar.Position := OveralPct;
    FileNamelabel.Caption := ExpandConstant('{app}\') + MinimizePathName(CurrentFile, FileNamelabel.Font, FileNamelabel.Width-ScaleX(100));
  Result := ISDoneCancel;
end;

function PBProc(h: hWnd; Msg, wParam, lParam: Longint): Longint;
var
  pr, i1, i2: Extended;
  w: integer;
begin
  Result := CallWindowProc(PBOldProc, h, Msg, wParam, lParam);
  if (Msg = $402) and (ISDoneProgressBar.Position > ISDoneProgressBar.Min) then begin
    i1 := ISDoneProgressBar.Position - ISDoneProgressBar.Min;
    i2 := ISDoneProgressBar.Max - ISDoneProgressBar.Min;
    pr := i1 * 100 / i2;
    w := Round(598 * pr / 100);
    UnpackingArcLabel.Caption := ExpandConstant('{cm:UnpackingArc}');
    ImgSetPosition(ProgressBarImg, ScaleX(93), ScaleY(311), w, ScaleY(25));
    ImgSetVisiblePart(ProgressBarImg, ScaleX(0), ScaleY(0), w, ScaleY(25));
    ImgApplyChanges(WizardForm.Handle);
  end;
end;

procedure CreateFrame;
begin
  Frame := TForm.Create(nil);
  Frame.BorderStyle := bsNone;
  CreateFormFromImage(Frame.Handle,ExpandConstant('{tmp}\frame.png'));
  with TLabel.Create(Frame) do begin
    Parent := Frame;
    Align := alClient;
    OnMouseDown := @FrameMouseDown;
  end;
  WizardForm.Left := Frame.Left;
  WizardForm.Top := Frame.Top;
  WFOldProc := SetWindowLong(WizardForm.Handle,-4,WndProcCallBack(@WFProc,4));
  Frame.Show;
end;

procedure WFDeInit;
begin
  Frame.Visible := False;
  WizardForm.Visible := False;
  SetWindowLong(WizardForm.Handle,-4,WFOldProc);
  Frame.Free;
end;

procedure WizardFormBtnClick(hBtn:HWND);
var
  Btn:TButton;
  ErrorCode: Integer;
begin
  case hBtn of
  CancelButton: begin
    if WizardForm.CurPageID = wpInstalling then begin
      SuspendProc;
      if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then
        ISDoneCancel := 1;
      ResumeProc;
      Exit;
    end else
    Btn := WizardForm.CancelButton;
  end;
  NextButton: Btn:= WizardForm.NextButton;
  BackButton: Btn:= WizardForm.BackButton;
  DirBrowseButton: Btn:= WizardForm.DirBrowseButton;
  GroupBrowseButton: Btn:= WizardForm.GroupBrowseButton;
  ExitButton: Btn := WizardForm.CancelButton;
  MinButton: begin
    SendMessage(WizardForm.Handle, WM_SYSCOMMAND, SC_MINIMIZE, 0);
    Exit;
  end;
end;
  Btn.OnClick(Btn);
  BtnRefresh(hBtn);
end;

procedure DirEditOnChange(Sender: TObject);
begin
  DirEditLabel.Caption := WizardForm.DirEdit.Text;
end;

procedure GroupEditOnChange(Sender: TObject);
begin
  GroupEditLabel.Caption := WizardForm.GroupEdit.Text;
end;

function NoStartIcon: boolean;
begin
  Result := BtnGetEnabled(GroupBrowseButton);
end;

procedure NoStartIconClick(hBtn: HWND);
var
  Check: boolean;
begin
  Check := BtnGetChecked(hBtn);
  BtnSetEnabled(GroupBrowseButton, not Check);
  WizardForm.NoIconsCheck.Checked := Check;
  if Check then NoStartIconLabel.Font.Color := {#FontColor2} else NoStartIconLabel.Font.Color := {#FontColor};
  if Check then GroupEditLabel.Font.Color := {#FontColor2} else GroupEditLabel.Font.Color := {#FontColor};
end;

function DesktopIcon: boolean;
begin
  Result := BtnGetChecked(DesktopIconCheckBox);
end;

function DirectX: boolean;
begin
  Result := BtnGetChecked(DirectXCheckBox);
end;

function VisualC: boolean;
begin
  Result := BtnGetChecked(VisualCCheckBox);
end;

procedure CheckBoxesClick(Sender: TObject);
begin
  case Sender of
    DesktopIconLabel: BtnSetChecked(DesktopIconCheckBox, not BtnGetChecked(DesktopIconCheckBox));
    DirectXLabel: BtnSetChecked(DirectXCheckBox, not BtnGetChecked(DirectXCheckBox));
    VisualCLabel: BtnSetChecked(VisualCCheckBox, not BtnGetChecked(VisualCCheckBox));
    NoStartIconLabel: begin
      BtnSetChecked(NoStartIconCheckBox, not BtnGetChecked(NoStartIconCheckBox));
      NoStartIconClick(NoStartIconCheckBox);
    end;
  end;
end;

procedure CreateImages;
begin
  Wizard1 := ImgLoad(WizardForm.Handle, ExpandConstant('{tmp}\frame.png'), ScaleX(0), ScaleY(0), WizardForm.ClientWidth, WizardForm.ClientHeight, True, True);
  Fon := ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\fon.png'),ScaleX(60), ScaleY(185), ScaleX(670),ScaleY(280),True,True)
  Edit := ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\Edit.png'),ScaleX(92), ScaleY(310), ScaleX(480), ScaleY(25),True,True);
  ProgressBarBkg := ImgLoad(WizardForm.Handle, ExpandConstant('{tmp}\PBBkg.png'), ScaleX(92), ScaleY(310), ScaleX(600), ScaleY(25), False, True);
  ProgressBarImg := ImgLoad(WizardForm.Handle, ExpandConstant('{tmp}\PBImg.png'), ScaleX(93), ScaleY(311), ScaleX(0), ScaleY(23), True, True);
end;

procedure CreateButtons;
begin
  CancelButton := BtnCreate(WizardForm.Handle, ScaleX(624), ScaleY(480), ScaleX(100), ScaleY(25), ExpandConstant('{tmp}\button.png'), 0, False);
  BackButton := BtnCreate(WizardForm.Handle, ScaleX(375), ScaleY(480), ScaleX(100), ScaleY(25), ExpandConstant('{tmp}\button.png'), 0, False);
  NextButton := BtnCreate(WizardForm.Handle, ScaleX(499), ScaleY(480), ScaleX(100), ScaleY(25), ExpandConstant('{tmp}\button.png'), 0, False);

  DirBrowseButton := BtnCreate(WizardForm.Handle, ScaleX(598), ScaleY(310), ScaleX(100), ScaleY(25), ExpandConstant('{tmp}\button.png'), 0, False);
  GroupBrowseButton := BtnCreate(WizardForm.Handle, ScaleX(598), ScaleY(310), ScaleX(100), ScaleY(25), ExpandConstant('{tmp}\button.png'), 0, False);

  ExitButton := BtnCreate(WizardForm.Handle, ScaleX(750), ScaleY(20), ScaleX(25), ScaleY(25), ExpandConstant('{tmp}\Off.png'), 0, False);
  MinButton := BtnCreate(WizardForm.Handle, ScaleX(720), ScaleY(20), ScaleX(25), ScaleY(25), ExpandConstant('{tmp}\Min.png'), 0, False);

  NoStartIconCheckBox := BtnCreate(WizardForm.Handle, ScaleX(92), ScaleY(421), ScaleX(25), ScaleY(25), ExpandConstant('{tmp}\CheckBox.png'), 0, True);
  DirectXCheckBox := BtnCreate(WizardForm.Handle, ScaleX(92), ScaleY(276), ScaleX(25), ScaleY(25), ExpandConstant('{tmp}\CheckBox.png'), 0, True);
  VisualCCheckBox := BtnCreate(WizardForm.Handle, ScaleX(92), ScaleY(306), ScaleX(25), ScaleY(25), ExpandConstant('{tmp}\CheckBox.png'), 0, True);
  DesktopIconCheckBox := BtnCreate(WizardForm.Handle, ScaleX(92), ScaleY(336), ScaleX(25), ScaleY(25), ExpandConstant('{tmp}\CheckBox.png'), 0, True);

  BtnSetFont(CancelButton, ButtonFont.Handle);
  BtnSetFont(NextButton, ButtonFont.Handle);
  BtnSetFont(BackButton, ButtonFont.Handle);
  BtnSetFont(DirBrowseButton, ButtonFont.Handle);
  BtnSetFont(GroupBrowseButton, ButtonFont.Handle);

  BtnSetEvent(ExitButton, BtnClickEventID, WrapBtnCallback(@WizardFormBtnClick, 1));
  BtnSetEvent(MinButton, BtnClickEventID, WrapBtnCallback(@WizardFormBtnClick, 1));
  BtnSetEvent(CancelButton, BtnClickEventID, WrapBtnCallback(@WizardFormBtnClick, 1));
  BtnSetEvent(NextButton, BtnClickEventID, WrapBtnCallback(@WizardFormBtnClick, 1));
  BtnSetEvent(BackButton, BtnClickEventID, WrapBtnCallback(@WizardFormBtnClick, 1));
  BtnSetEvent(DirBrowseButton, BtnClickEventID, WrapBtnCallback(@WizardFormBtnClick, 1));
  BtnSetEvent(GroupBrowseButton, BtnClickEventID, WrapBtnCallback(@WizardFormBtnClick, 1));
  BtnSetEvent(NoStartIconCheckBox,BtnClickEventID,WrapBtnCallback(@NoStartIconClick,1));

  BtnSetFontColor(CancelButton, {#FontColor}, {#FontColor1}, {#FontColor1}, {#FontColor2});
  BtnSetFontColor(NextButton, {#FontColor}, {#FontColor1}, {#FontColor1}, {#FontColor2});
  BtnSetFontColor(BackButton, {#FontColor}, {#FontColor1}, {#FontColor1}, {#FontColor2});
  BtnSetFontColor(DirBrowseButton, {#FontColor}, {#FontColor1}, {#FontColor1}, {#FontColor2});
  BtnSetFontColor(GroupBrowseButton, {#FontColor}, {#FontColor1}, {#FontColor1}, {#FontColor2});

  BtnSetText(CancelButton, ExpandConstant('{cm:Cancel}'));
  BtnSetText(BackButton, ExpandConstant('{cm:Back}'));
  BtnSetText(NextButton, ExpandConstant('{cm:Next}'));
  BtnSetText(DirBrowseButton, ExpandConstant('{cm:DirBrowse}'));
  BtnSetText(GroupBrowseButton, ExpandConstant('{cm:GroupBrowse}'));
end;

Procedure CreateLabels;
begin
  WelcomeLabel := TLabel.Create(WizardForm);
  with WelcomeLabel do begin
    SetBounds(ScaleX(176), ScaleY(230), ScaleX(450), ScaleY(55));
    AutoSize    := false;
    Transparent := true;
    WordWrap    := true;
    ParentFont  := True;
    Alignment   := taCenter;
    Font.Size   := 15;
    Font.Style  := [fsBold];
    Font.Name   := {#FontName};
    Font.Color  := {#FontColor};
    Parent      := WizardForm;
    Caption     := ExpandConstant('{cm:Welcome1}');
  end;

  WelcomeLabel2 := TLabel.Create(WizardForm);
  with WelcomeLabel2 do begin
    SetBounds(ScaleX(176), ScaleY(320), ScaleX(450), ScaleY(110));
    AutoSize    := false;
    WordWrap    := true;
    Alignment   := taCenter;
    Font.Size   := 10;
    Font.Name   :={#FontName};
    Font.Color  :={#FontColor};
    Transparent := true;
    Parent      := WizardForm;
    Caption     := ExpandConstant('{cm:Welcome2}');
  end;

  SelectDir := TLabel.Create(WizardForm);
  with SelectDir do begin
    SetBounds(ScaleX(92), ScaleY(230), ScaleX(450), ScaleY(25));
    AutoSize    := false;
    WordWrap    := true;
    Font.Size   := 10;
    Font.Style  := [fsBold];
    Font.Name   := {#FontName};
    Font.Color  := {#FontColor};
    Transparent := true;
    Parent      := WizardForm;
    Caption     := ExpandConstant('{cm:SelectDir1}');
  end;

  SelectDir2 := TLabel.Create(WizardForm);
  with SelectDir2 do begin
    SetBounds(ScaleX(92), ScaleY(345), ScaleX(450), ScaleY(40));
    AutoSize    := false;
    WordWrap    := true;
    Font.Size   := 10;
    Font.Name   := {#FontName};
    Font.Color  := {#FontColor};
    Transparent := true;
    Parent      := WizardForm;
    Caption     := ExpandConstant('{cm:SelectDir2}');
  end;

  NoStartIconLabel := TLabel.Create(WizardForm);
  with NoStartIconLabel do begin
    SetBounds(ScaleX(125), ScaleY(425), ScaleX(400), ScaleY(16));
    AutoSize    := false;
    WordWrap    := true;
    Font.Size   := 10
    Font.Name   := {#FontName};
    Font.Color  := {#FontColor};
    Transparent := true;
    Parent      := WizardForm;
    OnClick     := @CheckBoxesClick;
    Caption     := ExpandConstant('{cm:NoStartIcon}');
  end;

  DirEditLabel := TLabel.Create(WizardForm);
  with DirEditLabel do begin
    SetBounds(ScaleX(100), ScaleY(314), ScaleX(475), ScaleY(16));
    AutoSize      := False;
    WordWrap      := True;
    ShowAccelChar := False;
    Transparent   := True;
    Font.Size     := 10;
    Font.Name     := {#FontName}
    Font.Color    := {#FontColor};
    Caption       := WizardForm.DirEdit.Text;
    Parent        := WizardForm;
  end;

  GroupEditLabel := TLabel.Create(WizardForm);
  with GroupEditLabel do begin
    SetBounds(ScaleX(100), ScaleY(314), ScaleX(475), ScaleY(16));
    AutoSize      := False;
    WordWrap      := True;
    ShowAccelChar := False;
    Transparent   := True;
    Font.Size     := 10;
    Font.Name     := {#FontName}
    Font.Color    := {#FontColor};
    Caption       := WizardForm.GroupEdit.Text;
    Parent        := WizardForm;
  end;

  DirectXLabel := TLabel.Create(WizardForm);
  with DirectXLabel do begin
    SetBounds(ScaleX(130), ScaleY(280), ScaleX(200), ScaleY(16));
    AutoSize    := false;
    Font.Size   := 10
    Font.Name   := {#FontName};
    Font.Color  := {#FontColor};
    Transparent := true;
    Parent      := WizardForm;
    OnClick     := @CheckBoxesClick;
    Caption     := ExpandConstant('{cm:DirectX}');
  end;

  VisualCLabel := TLabel.Create(WizardForm);
  with VisualCLabel do begin
    SetBounds(ScaleX(130), ScaleY(309), ScaleX(300), ScaleY(16));
    AutoSize    := false;
    Font.Size   := 10
    Font.Name   := {#FontName};
    Font.Color  := {#FontColor};
    Transparent := true;
    Parent      := WizardForm;
    OnClick     := @CheckBoxesClick;
    Caption     := ExpandConstant('{cm:VC}');
  end;

  DesktopIconLabel := TLabel.Create(WizardForm);
  with DesktopIconLabel do begin
    SetBounds(ScaleX(130), ScaleY(339), ScaleX(370), ScaleY(16));
    AutoSize    := false;
    Font.Size   := 10
    Font.Name   := {#FontName};
    Font.Color  := {#FontColor};
    Transparent := true;
    Parent      := WizardForm;
    OnClick     := @CheckBoxesClick;
    Caption     := ExpandConstant('{cm:DesktopIcon}');
  end;

  SelectTasks := TLabel.Create(WizardForm);
  with SelectTasks do begin
    SetBounds(ScaleX(92), ScaleY(385), ScaleX(450), ScaleY(50));
    AutoSize    := false;
    WordWrap    := true;
    Font.Size   := 10;
    Font.Name   := {#FontName};
    Font.Color  := {#FontColor};
    Transparent := true;
    Parent      := WizardForm;
    Caption     := ExpandConstant('{cm:SelectTasks}');
  end;

  NeedInstallSizeLabel := TLabel.Create(WizardForm);
  with NeedInstallSizeLabel do begin
    SetBounds(ScaleX(90), ScaleY(425), ScaleX(440), ScaleY(16));
    AutoSize    := True;
    Transparent := True;
    Parent      := WizardForm;
    Font.Size   := 10;
    Font.Name   := {#FontName};
    Font.Color  := {#FontColor};
    Caption     := WizardForm.DiskSpaceLabel.Caption;
  end;

  UnpackingArcLabel := TLabel.Create(WizardForm);
  with UnpackingArcLabel do begin
    SetBounds(ScaleX(92), ScaleY(230), ScaleX(450), ScaleY(16));
    AutoSize    := False;
    Transparent := True;
    Parent      := WizardForm;
    Font.Size   := 10;
    Font.Style  := [fsBold];
    Font.Name   := {#FontName};
    Font.Color  := {#FontColor};
  end;

  FileNameLabel := TLabel.Create(WizardForm);
  with FileNameLabel do begin
    SetBounds(ScaleX(92), ScaleY(290), ScaleX(598), ScaleY(16));
    AutoSize    := False;
    Transparent := True;
    Parent      := WizardForm;
    Font.Size   := 10;
    Font.Name   := {#FontName};
    Font.Color  := {#FontColor};
  end;

  ISDoneErrorLabel := TLabel.Create(WizardForm);
  with ISDoneErrorLabel do begin
    SetBounds(ScaleX(176), ScaleY(360), ScaleX(450), ScaleY(110));
    AutoSize    := false;
    WordWrap    := true;
    Alignment   := taCenter;
    Font.Size   := 10;
    Font.Name   := {#FontName};
    Font.Color  := {#FontColor};
    Transparent := true;
    Parent      := WizardForm;
    Caption     := ExpandConstant('{cm:Finished2}');
  end;
end;

procedure InitializeWizard;
begin
  if not FontExists({#FontName}) then begin ExtractTemporaryFile('{#Font}');
    AddFontResource(ExpandConstant('{tmp}\{#Font}'), FR_PRIVATE, 0);
  end;
  with WizardForm do begin
    BorderStyle  := bsNone;
    ClientWidth  := ScaleX(796);
    ClientHeight := ScaleY(537);
    InnerNotebook.Hide;
    OuterNotebook.Hide;
    NextButton.Width   := ScaleX(0);
    BackButton.Width   := ScaleX(0);
    CancelButton.Width := ScaleX(0);
    Bevel.Hide;
    Position := poDesktopCenter;
    DirEdit.OnChange   := @DirEditOnChange;
    GroupEdit.OnChange := @GroupEditOnChange;
    ProgressGauge.Max  := 1000;
    Font.Name := {#FontName};
  end;

  PBOldProc := 0;

  with TLabel.Create(WizardForm) do begin
    Parent := WizardForm;
    Align := alClient;
    Transparent := true;
    OnMouseDown := @FrameMouseDown;
  end;

  ButtonFont := TFont.Create;
  with ButtonFont do begin
    Name := {#FontName};
    Size := 12;
  end;

  CreateImages;
  CreateButtons;
  CreateLabels;
  CreateFrame;
  init_taskbar;

  ISDoneProgressBar := TNewProgressBar.Create(WizardForm);
  with ISDoneProgressBar do begin
    Parent := WizardForm;
    Max := 1000;
    Hide;
  end;

  ExtractTemporaryFile('Music.mp3');
  BASS_Init('{tmp}\Music.mp3');
  BASS_CreateOnOffButton(WizardForm, '{tmp}\MusicButton.png', ScaleX(690), ScaleY(20), ScaleX(25), ScaleY(25), 4);
  ExtractTemporaryFile('form.bmp');
  SetRgn(WizardForm.Handle,'form.bmp', ScaleX(796), ScaleY(537));
  OldMinimizeAnimation := GetMinimizeAnimation;
  SetMinimizeAnimation(False);
  PBOldProc := SetWindowLong(ISDoneProgressBar.Handle, -4, WndProcCallBack(@PBProc, 4));
  ImgApplyChanges(WizardForm.Handle);
  ISInit := True;
end;

procedure HideComponents;
begin
  ImgSetVisibility(Edit,False);
  ImgSetVisibility(ProgressBarBkg, False);
  ImgSetVisibility(ProgressBarImg, False);

  BtnSetVisibility(BackButton, False);
  BtnSetVisibility(NextButton, False);
  BtnSetVisibility(DirBrowseButton, false);
  BtnSetVisibility(GroupBrowseButton, false);
  BtnSetVisibility(NoStartIconCheckBox, false);
  BtnSetVisibility(DirectXCheckBox, false);
  BtnSetVisibility(VisualCCheckBox, false);
  BtnSetVisibility(DesktopIconCheckBox, false);

  WelcomeLabel.Hide;
  WelcomeLabel2.Hide;
  DirectXLabel.Hide;
  DesktopIconLabel.Hide;
  NoStartIconLabel.Hide;
  VisualCLabel.Hide;
  SelectDir.Hide;
  SelectDir2.Hide;
  SelectTasks.Hide;
  DirEditLabel.Hide;
  GroupEditLabel.Hide;
  UnpackingArcLabel.Hide;
  FileNameLabel.Hide;
  ISDoneErrorLabel.Hide;
  NeedInstallSizeLabel.Hide;
end;

Procedure ShowComponents(CurPageID: Integer);
Begin
  case CurPageID of
    wpWelcome: begin
      WelcomeLabel.Show;
      WelcomeLabel2.Show;
      BtnSetVisibility(NextButton, True);
      BtnSetText(NextButton, ExpandConstant('{cm:Next}'));
    end;

    wpSelectDir: begin
      BtnSetVisibility(BackButton, True);
      BtnSetVisibility(NextButton, True);
      BtnSetText(NextButton, ExpandConstant('{cm:Next}'));
      BtnSetVisibility(DirBrowseButton, true);
      ImgSetVisibility(Edit,True);
      DirEditLabel.Show;
      SelectDir.Show;
      SelectDir.Caption := ExpandConstant('{cm:SelectDir1}');
      SelectDir2.Show;
      NeedInstallSizeLabel.Show;
      DirEditOnChange(nil);
    end;

    wpSelectProgramGroup: begin
      BtnSetVisibility(BackButton, True);
      BtnSetVisibility(NextButton, True);
      BtnSetText(NextButton, ExpandConstant('{cm:Next}'));
      BtnSetVisibility(GroupBrowseButton, true);
      BtnSetVisibility(NoStartIconCheckBox, True);
      ImgSetVisibility(Edit,True);
      GroupEditLabel.Show;
      WizardForm.GroupEdit.Show;
      SelectDir.Show;
      SelectDir.Caption := ExpandConstant('{cm:SelectGroup1}');
      SelectDir2.Show;
      NoStartIconLabel.Show;
    end;

    wpSelectTasks: begin
      BtnSetVisibility(BackButton, True);
      BtnSetVisibility(NextButton, True);
      BtnSetText(NextButton, ExpandConstant('{cm:Install}'));
      BtnSetVisibility(DesktopIconCheckBox, true);
      BtnSetVisibility(DirectXCheckBox, true);
      BtnSetVisibility(VisualCCheckBox, true);
      SelectDir.Show;
      SelectDir.Caption := ExpandConstant('{cm:SelectTasks1}');
      SelectTasks.Show;
      VisualCLabel.Show;
      DirectXLabel.Show;
      DesktopIconLabel.Show;
    end;

    wpInstalling: begin
      ImgSetVisibility(ProgressBarBkg, True);
      ImgSetVisibility(ProgressBarImg, True);
      UnpackingArcLabel.Show;
      FileNameLabel.Show;
    end;

    wpFinished: begin
      BtnSetVisibility(CancelButton, False);
      BtnSetVisibility(NextButton, True);
      BtnSetText(NextButton, ExpandConstant('{cm:Finish}'));
      WelcomeLabel.Show;
      WelcomeLabel.Caption := ExpandConstant('{cm:Finished1}');
      ISDoneErrorLabel.Show;
      if ISDoneError then
        ISDoneErrorLabel.Caption := ExpandConstant('{cm:ISDoneError}');
    end;
  end;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  HideComponents;
  ShowComponents(CurPageID);
  ImgApplyChanges(WizardForm.Handle);
end;

function CheckError: boolean;
begin
  Result := not ISDoneError;
  FileNameLabel.Hide
  if Result and DirectX then
    UnpackingArcLabel.Caption := ExpandConstant('{cm:SoftInstalling}');
  if Result and VisualC then
    UnpackingArcLabel.Caption := ExpandConstant('{cm:SoftInstalling}');
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssInstall then begin
    ISDoneCancel := 0;
    ExtractTemporaryFile('unarc.dll');
    ExtractTemporaryFile('facompress.dll');
    #ifdef PrecompInside
       ExtractTemporaryFile('CLS-precomp.dll');
       ExtractTemporaryFile('packjpg_dll.dll');
       ExtractTemporaryFile('packjpg_dll1.dll');
       ExtractTemporaryFile('precomp.exe');
       ExtractTemporaryFile('zlib1.dll');
    #endif
    #ifdef SrepInside
       ExtractTemporaryFile('CLS-srep.dll');
    #endif
    #ifdef records
       ExtractTemporaryFile('records.inf');
    #endif
    ISDoneError := True;
    if ISDoneInit(ExpandConstant('{src}\records.inf'), $F777, 0, 0, 0, 0, 512, @ProgressCallback) then begin
      repeat
        #ifdef SrepInside
           if not SrepInit(ExpandConstant('{app}\'), 512, 0) then break;
        #endif
        #ifdef PrecompInside
           if not PrecompInit(ExpandConstant('{app}\'), 128, 0) then break;
        #endif
        if not FileSearchInit(True) then break;
//        if not ShowChangeDiskWindow ('Ïîæàëóéñòà, âñòàâüòå äèñê ñ èãðîé è äîæäèòåñü åãî èíèöèàëèçàöèè.', ExpandConstant('{src}'),'data.bin') then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\data.bin'), ExpandConstant('{app}'), '', False, '', '', ExpandConstant('{app}'), notPCFonFLY) then break;
//        if not ShowChangeDiskWindow ('Ïîæàëóéñòà, âñòàâüòå äèñê ñ èãðîé è äîæäèòåñü åãî èíèöèàëèçàöèè.', ExpandConstant('{src}'),'video.bin') then break;
//        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\video.bin'), ExpandConstant('{app}'), '', False, '', '', ExpandConstant('{app}'), notPCFonFLY) then break;
        ISDoneError := False;
      until True;
      ISDoneStop;
    end;
    BtnSetEnabled(CancelButton, False);
  end;
  if (CurStep = ssPostInstall) and ISDoneError then begin
    UnpackingArcLabel.Hide;
    FileNameLabel.Hide
    ImgSetVisibility(ProgressBarBkg, False);
    ImgSetVisibility(ProgressBarImg, False);
    ISDoneErrorLabel.Font.Color := clRed;
    Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', False);
  end;
end;

procedure DeinitializeSetup();
begin
  if ISInit then begin
    if PBOldProc <> 0 then
      SetWindowLong(ISDoneProgressBar.Handle, -4, PBOldProc);
    WFDeInit;
    SetWindowLong(WizardForm.Handle,-4,WFOldProc);
    SetMinimizeAnimation(OldMinimizeAnimation);
    gdipShutdown;
    ButtonFont.Free
    RemoveFontResource(ExpandConstant('{tmp}\{#Font}'), FR_PRIVATE, 0);
    WizardForm.Free;
    BASS_DeInit;
  end;
end;
[/spoiler]
 
Последнее редактирование:

Shegorat

Lord of Madness
Администратор
Почему вырезание формы на юникоде не пашет? вот пример...
Все работает, одно но
Код:
function LoadImage(hInst: THandle; ImageName: [color=red][b]PAnsiChar[/b][/color]; ImageType: UINT; X, Y: Integer; Flags: UINT): THandle; external 'LoadImageA@user32.dll stdcall';
 

Shift85

Старожил
Подскажите пожалуйста как на деинсталлятор прикрутить свой шрифт для кнопок...

Пробовал так не работает...:( Ошибку выбивает: http://rghost.ru/53729756

Код:
var
hCancelUninstBtn: HWND;
ButtonFontU:TFont;

procedure BtnSetFontU(h :HWND; Font :Cardinal); external 'BtnSetFont@{tmp}\b2p.dll stdcall delayload';

procedure InitializeUninstallProgressForm();
begin 
ButtonFontU:=TFont.Create;
with ButtonFontU do begin
Name:='Tahoma';
Size:= 8;
Style:=[];
end;

with UninstallProgressForm.CancelButton do begin    
BtnSetFontU(hCancelUninstBtn,ButtonFontU.Handle);
end;
 

nik1967

Old Men
Проверенный
Shift85, попробуй не изобретать велосипед,
[SOURCE="inno"]var
hCancelUninstBtn: HWND;
ButtonFontU:TFont;

procedure InitializeUninstallProgressForm();
begin
ButtonFontU:=TFont.Create;
with ButtonFontU do begin
Name:='Tahoma';
Size:= 8;
Style:=[];
end;

with UninstallProgressForm.CancelButton do begin
BtnSetFont(hCancelUninstBtn,ButtonFontU.Handle);
end;[/SOURCE]
Сам не пробовал, так, что со 100% уверенностью сказать не могу.
Подразумевается, что procedure BtnSetFont(h :HWND; Font :Cardinal); external 'BtnSetFont@{tmp}\b2p.dll stdcall delayload'; у тебя где-то уже прописана.
 
Последнее редактирование:
Статус
В этой теме нельзя размещать новые ответы.
Сверху