inno setup pplive yang

阅读更多
#define MyAppName "PPTV"
#define MyAppExeName"PPTV"
#define MyAppVersion "1.0.0.0"
[Setup]
AppName={#MyAppName}
AppVersion={#MyAppName}
AppVerName={#MyAppName}
AppPublisher={#MyAppName}
DefaultDirName={pf}\PPLive\PPTV
DefaultGroupName={#MyAppName}
OutputDir=.
OutputBaseFilename={#MyAppName}
SetupIconFile=install.ico
UninstallIconFile=install.ico
VersionInfoVersion={#MyAppVersion}
VersionInfoTextVersion={#MyAppVersion}
VersionInfoDescription=《{#MyAppName}》安装包
versioninfocopyright=逆风丶蔷薇花瓣 出品
VersionInfoProductName={#MyAppName}
VersionInfoProductTextVersion={#MyAppVersion}
VersionInfoProductVersion={#MyAppVersion}
VersionInfoCompany=逆风丶蔷薇花瓣 版权所有
DisableReadyPage=yes
DisableProgramGroupPage=yes
DirExistsWarning=no
DisableDirPage=yes
//压缩级别
//InternalCompressLevel=ultra64
//压缩算法
Compression=lzma2/ultra64
[Messages]
BeveledLabel=Copyright(C)2012-2015 逆风丶蔷薇花瓣
SetupWindowTitle={#MyAppName}

[Icons]
Name: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\PPLive\{#MyAppName}\{#MyAppName}; Filename: {app}\Program\Thunder.exe; WorkingDir: {app}; Check: StartMenu;
//开始菜单快捷方式
Name: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\PPLive\{#MyAppName}\卸载 {#MyAppName}; Filename:{uninstallexe}; WorkingDir: {app}; Check: StartMenu;
//开始菜单卸载程序
Name: {commondesktop}\{#MyAppName}; Filename: {app}\Program\Thunder.exe; WorkingDir: {app}; Check: desktop;
//桌面快捷方式
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\{#MyAppName}; Filename: {app}\Thunder.exe; WorkingDir: {app}; Check: StartMenu;
//开始菜单快速引导栏

[registry]
Root:HKLM;Subkey:"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";ValueType:string;ValueName:"PPTV";ValueData:"{app}\Program\Thunder.exe";check:regedit;
//开机自启动注册表
[Files]
Source: {tmp}\*; DestDir: {tmp}; Flags: dontcopy solidbreak ; Attribs: hidden system
//Source: "D:\软件\迅雷7\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
//以上是包含文件夹的目录
//包含文件夹recursesubdirs createallsubdirs   卸载时不删除uninsneveruninstall      卸载时删除ignoreversion




type
  TBtnEventProc = procedure (h:HWND);
  TPBProc = function(h:hWnd;Msg,wParam,lParam:Longint):Longint;  //百分比

Const
//鼠标指向
  MyCursor1 = 101;
  MyCursor2 = 102;
  Radius  = 9;
  GWL_EXSTYLE = (-20);
  GCL_STYLE = (-26);
  CS_DROPSHADOW = $20000;
//窗口移动
  WM_SYSCOMMAND = $0112;
//卸载
//  WS_EX_APPWINDOW = $40000;
//按钮
  BtnClickEventID      = 1;
  BtnMouseEnterEventID = 2;

//botva2
function ImgLoad(Wnd :HWND; FileName AnsiChar; Left, Top, Width, Height :integer; Stretch, IsBkg :boolean) :Longint; external 'ImgLoad@{tmp}\botva2.dll stdcall delayload';
procedure ImgSetVisibility(img :Longint; Visible :boolean); external 'ImgSetVisibility@{tmp}\botva2.dll stdcall delayload';
procedure ImgApplyChanges(h:HWND); external 'ImgApplyChanges@{tmp}\botva2.dll stdcall delayload';
procedure ImgSetPosition(img :Longint; NewLeft, NewTop, NewWidth, NewHeight :integer); external 'ImgSetPosition@files:botva2.dll stdcall';
procedure ImgSetTransparent(img:Longint; Value:integer); external 'ImgSetTransparent@{tmp}\botva2.dll stdcall delayload';
procedure ImgRelease(img :Longint); external 'ImgRelease@{tmp}\botva2.dll stdcall delayload';
procedure gdipShutdown;  external 'gdipShutdown@{tmp}\botva2.dll stdcall delayload';
function WrapBtnCallback(Callback: TBtnEventProc; ParamCount: Integer): Longword; external 'wrapcallback@{tmp}\innocallback.dll stdcall delayload';
function BtnCreate(hParent:HWND; Left,Top,Width,Height:integer; FileName:PAnsiChar; ShadowWidth:integer; IsCheckBtn:boolean):HWND;  external 'BtnCreate@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetText(h:HWND; Text:PAnsiChar);  external 'BtnSetText@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetVisibility(h:HWND; Value:boolean); external 'BtnSetVisibility@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetFont(h:HWND; Font:Cardinal); external 'BtnSetFont@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetFontColor(h:HWND; NormalFontColor, FocusedFontColor, PressedFontColor, DisabledFontColor: Cardinal); external 'BtnSetFontColor@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetEvent(h:HWND; EventID:integer; Event:Longword); external 'BtnSetEvent@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetCursor(h:HWND; hCur:Cardinal); external 'BtnSetCursor@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetEnabled(h:HWND; Value:boolean); external 'BtnSetEnabled@{tmp}\botva2.dll stdcall delayload';
function GetSysCursorHandle(id:integer):Cardinal; external 'GetSysCursorHandle@{tmp}\botva2.dll stdcall delayload';
function BtnGetChecked(h:HWND):boolean; external 'BtnGetChecked@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetChecked(h:HWND; Value:boolean); external 'BtnSetChecked@{tmp}\botva2.dll stdcall delayload';
procedure CreateFormFromImage(h:HWND; FileName:PAnsiChar); external 'CreateFormFromImage@{tmp}\botva2.dll stdcall delayload';
function SetWindowLong(Wnd: HWnd; Index: Integer; NewLong: Longint): Longint; external '[email protected] stdcall';
function PBCallBack(P:TPBProc;ParamCount:integer):LongWord; external 'wrapcallback@files:innocallback.dll stdcall';
function CallWindowProc(lpPrevWndFunc: Longint; hWnd: HWND; Msg: UINT; wParam, lParam: Longint): Longint; external '[email protected] stdcall';
procedure ImgSetVisiblePart(img:Longint; NewLeft, NewTop, NewWidth, NewHeight : integer); external 'ImgSetVisiblePart@files:botva2.dll stdcall';
function SetLayeredWindowAttributes(hwnd:HWND; crKey:Longint; bAlpha:byte; dwFlags:longint ):longint;
  external 'SetLayeredWindowAttributes@user32 stdcall';
function SetClassLong(hWnd: HWND; nlndex: integer; dwNewLong: integer ): integer; external 'SetClassLongA@user32 stdcall';
function GetClassLong(IntPtr:hwnd;nIndex:integer ):integer; external 'GetClassLongA@user32 stdcall';
function CreateRoundRectRgn(p1, p2, p3, p4, p5, p6: Integer): THandle; external 'CreateRoundRectRgn@gdi32 stdcall';
function SetWindowRgn(hWnd: HWND; hRgn: THandle; bRedraw: Boolean): Integer; external 'SetWindowRgn@user32 stdcall';
function ReleaseCapture(): Longint; external '[email protected] stdcall';
//安装过程图片轮播
function NewWebWnd(hWndParent: HWND; X, Y, nWidth, nHeight: Integer): HWND; external 'newwebwnd@files:webctrl.dll stdcall';
function FreeAllWebWnd(): Boolean; external 'freeallwebwnd@files:webctrl.dll stdcall';
function WebWndSetParent(hWndWeb: HWND; hWndParent: HWND): Boolean; external 'webwndsetparent@files:webctrl.dll stdcall';
function DisplayHTMLPage(hWndWeb: HWND; lpsURL: PChar): Boolean; external 'displayhtmlpage@files:webctrl.dll stdcall';

//窗口圆角
procedure ShapeForm(aForm: TForm; edgeSize: integer);
var
  FormRegion:LongWord;
begin
  FormRegion:=CreateRoundRectRgn(0,0,aForm.Width,aForm.Height,edgeSize-6,edgeSize-6);
  SetWindowRgn(aForm.Handle,FormRegion,True);
end;
var
//取消窗口
CancelImage: Longint;
CancelForm: TSetupForm;
OKButton: TButton;
//右上角按钮+取消窗口
CloseBtn,CancelCloseBtn: HWND;
IconI:HWND;
//最小化窗口按钮
MinBtn:HWND;
//按钮
OKBtn,CancelFormBtn:HWND;
//窗口
WizardFormImage: Longint;
gddh,pbImg,pbbgImg: Longint;
//按钮
CancelBtn,backBtn,Startbtn,NextBtn,nextbtn1,DirBrowseBtn,Finbtn: HWND;
//勾选框
A2Check,A3Check,A4Check,A5Check,A6Check,A7Check,A8Check: HWND;
//文字标签
Label1,Label2,Label3,Label4,Label5,Label6,Label7,Label8,Label9,Label10:tlabel;
Label11,Label12,Label13:tlabel;
Edit1:Tedit;
WelTx1,WelTx2,PrLabel,PrLabel1:Tlabel;
//硬盘显示
FreeMB,TotalMB: Cardinal;
PBOldProc : Longint;
//阴影框
IsFrameDragging : boolean;
dx,dy,dh1 : integer;
Frame : TForm;
//按钮文字
WFButtonFont:tfont;
//安装过程图片
InstallingImage: HWND;

//百分比
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 (WizardForm.ProgressGauge.Position>WizardForm.ProgressGauge.Min) then begin
    i1:=WizardForm.ProgressGauge.Position-WizardForm.ProgressGauge.Min;
    i2:=WizardForm.ProgressGauge.Max-WizardForm.ProgressGauge.Min;
    pr:=i1*100/i2;
    PrLabel.Caption:=IntToStr(Round(pr))+'%';
    w:=Round(451*pr/100);
    if w<460 then
    begin
    ImgSetPosition(pbImg,18+w,327,99,25);
    end;
    ImgSetPosition(pbImg,20,327,w,25);
//    ImgSetVisiblePart(pbImg,0,0,w,25);
    ImgApplyChanges(WizardForm.Handle);
  end;
end;

//磁盘
function NumToStr(Float: Extended): string;
begin
  Result:=Format('%.2n', [Float]);
end;
function MbOrTB(Float: Extended): string;
begin
  if Float<1024 then Result:=NumToStr(Float)+' MB'
  else if (Float/1024)<1024 then Result:=NumToStr(Float/1024)+' GB'
  else if (Float/(1024*1024))<1024 then Result:=NumToStr(Float/(1024*1024))+' TB'
end;
procedure GetFreeSpaceCaption(Sender: TObject);
begin
  WizardForm.DirEdit.Text:=WizardForm.DirEdit.Text;
  if GetSpaceOnDisk(ExtractFileDrive(WizardForm.DirEdit.Text),True,FreeMB,TotalMB) then
  begin
    WelTx2.Font.Color :=clSilver;
    WelTx2.Caption:= ExpandConstant('可用空间: ') + MbOrTB(FreeMB) ;
    BtnSetEnabled(NextBtn,true)
  end else
  begin
    WelTx2.Font.Color:=clRed
    WelTx2.Caption:= '错误安装路径或者空间不足';
    if WelTx2.Caption='错误安装路径或者空间不足'then
    begin
    BtnSetEnabled(NextBtn,false)
   end
end
end;
//窗口移动
//procedure WizardFormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
//begin
//  ReleaseCapture
//  SendMessage(WizardForm.Handle, WM_SYSCOMMAND, $F012, 0)
//end;
//*************外框**************
procedure WizardMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture
  SendMessage(WizardForm.Handle, WM_SYSCOMMAND, $F012, 0)
end;

procedure WizardFormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  IsFrameDragging:=True;
  dx:=X;
  dy:=Y;
end;

procedure WizardFormMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  IsFrameDragging:=False;
  WizardForm.Show;
end;

procedure WizardFormMouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
begin
  if IsFrameDragging then begin
    WizardForm.Left:=WizardForm.Left+X-dx;
    WizardForm.Top:=WizardForm.Top+Y-dy;
    Frame.Left:=WizardForm.Left-10;
    Frame.Top:=WizardForm.Top-10;
  end;
end;
procedure frameFormMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  WizardForm.Show;
end;

procedure WizardFormcc;
begin
    WizardForm.OnMouseDown:=@WizardFormMouseDown;
    WizardForm.OnMouseUp:=@WizardFormMouseUp;
    WizardForm.OnMouseMove:=@WizardFormMouseMove;
end;

procedure CreateFrame;
begin
  IsFrameDragging:=False;
  Frame:=TForm.Create(nil);;
  Frame.BorderStyle:=bsNone;
  CreateFormFromImage(Frame.Handle,ExpandConstant('{tmp}\bg00.png'));
  with TLabel.Create(Frame) do begin
    Parent:=Frame;
    AutoSize:=false;
    Left:=0;
    Top:=0;
    Width:=Frame.CLientWidth;
    Height:=Frame.ClientHeight;
    OnMouseDown:=@frameFormMouseUp;
  end;
  WizardForm.Left:=Frame.Left+10;
  WizardForm.Top:=Frame.Top+10;
  Frame.Show;
end;
//*************外框**************

//“快速安装”按钮点击事件
procedure NextBtn1Click(hBtn:HWND);
begin
WizardForm.NextButton.Click;
end;
//“浏览”按钮点击事件
procedure EditdirOnClick(hBtn:HWND);
begin
WizardForm.DirBrowseButton.Click;
Edit1.Text:=WizardForm.DirEdit.Text;
end;
//“自定义目录”修改
procedure Editchanged(Sender: TObject);
begin
WizardForm.DirEdit.Text:=Edit1.Text;
end;
//最小化按钮
procedure MinBtnOnClick(hBtn:HWND);
begin
SendMessage(WizardForm.Handle,WM_SYSCOMMAND,61472,0);
end;
//取消窗口
procedure CancelFormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture
  SendMessage(CancelForm.Handle, WM_SYSCOMMAND, $F012, 0)
end;
//“立即体验”按钮点击事件
procedure FinbtnClick(hBtn:HWND);
begin
WizardForm.NextButton.Click;
end;
//取消窗口关闭按钮
procedure CancelCloseBtnOnClick(hBtn:HWND);
begin
CancelForm.close;
end;
//确定按钮
procedure OKBtnOnClick(hBtn:HWND);
begin
OKButton.Click;
end;
//取消窗口取消按钮
procedure CancelBtnOnClick(hBtn:HWND);
begin
CancelForm.close;
end;
//全局取消按钮点击事件
procedure CancelbtnClick(hBtn:HWND);
begin
  WizardForm.CancelButton.Click;
end;

//************注册表*********************
Function regedit(): Boolean;
begin
if BtngetChecked(Finbtn) = True then
  Result :=BtngetChecked(Finbtn)
end;
//***********添加桌面快捷方式***************
Function desktop(): Boolean;
begin
  if BtngetChecked(Finbtn) = True then
  Result :=BtngetChecked(Finbtn)
end;
//************开始菜单栏*************
Function StartMenu(): Boolean;
begin
  if BtngetChecked(Finbtn) = True then
  Result :=BtngetChecked(Finbtn)
end;


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

procedure InitializeWizard();
begin
ExtractTemporaryFile('bg00.png');

ExtractTemporaryFile('bg01t.png');
ExtractTemporaryFile('bg02t.png');
ExtractTemporaryFile('bg03t.png');

ExtractTemporaryFile('bg01.png');
ExtractTemporaryFile('bg02.png');
ExtractTemporaryFile('bg03.png');
ExtractTemporaryFile('bg_cancel.png');
ExtractTemporaryFile('change.png');
ExtractTemporaryFile('close.png');
ExtractTemporaryFile('mini.png');
ExtractTemporaryFile('install.png');
ExtractTemporaryFile('cancel_ok.png');
ExtractTemporaryFile('cancel_back.png');
ExtractTemporaryFile('Pbbg.png');
ExtractTemporaryFile('Pbjd.png');
ExtractTemporaryFile('finish.png');
ExtractTemporaryFile('newfeather1.png');
ExtractTemporaryFile('newfeather2.png');
ExtractTemporaryFile('newfeather3.png');
ExtractTemporaryFile('newfeather4.png');
ExtractTemporaryFile('InstallingImage.htm');

WizardForm.BorderStyle:=bsnone
//主界面框大小
WizardForm.Width:=582
WizardForm.Height:=360
WizardForm.OnMouseDown:=@WizardFormMouseDown;
WizardFormcc;
CreateFrame;
//ShapeForm(WizardForm, radius);//圆角
WFButtonFont:=TFont.Create;
WFButtonFont.Name:='微软雅黑'
WFButtonFont.Size:=9;
//SetClassLong:=(Wizard.Handle,-26,GetWindowLong(WinzardForm.Handle,-26)+$20000);
WizardFormImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg01t.png'),(-10), (-10),WizardForm.ClientWidth,WizardForm.ClientHeight,True,True);

//卸载界面左下角文字
WizardForm.OuterNotebook.Hide;
WizardForm.Bevel.Hide;
WizardForm.BeveledLabel.Width := 0
WizardForm.BeveledLabel.Height := 0

//****************全局界面按钮****************
//最小化按钮
MinBtn:=BtnCreate(WizardForm.Handle,518,8,30,31,ExpandConstant('{tmp}\mini.png'),3,False);
BtnSetEvent(MinBtn,BtnClickEventID,WrapBtnCallback(@MinBtnOnClick,1));

//取消按钮
CancelBtn:=BtnCreate(WizardForm.Handle,543,8,30,31,ExpandConstant('{tmp}\close.png'),1,False)
BtnSetEvent(CancelBtn,BtnClickEventID,WrapBtnCallback(@CancelBtnClick,1));


//**************第一页字体和按钮******************


//**************第一页字体和按钮******************
Edit1 := TEdit.Create(WizardForm);
Edit1.Parent := WizardForm;
Edit1.Text := WizardForm.DirEdit.Text;//自定义目录文字
Edit1.Font.Size:=9
Edit1.Left := 23;
Edit1.Top := 306 ;
Edit1.Width :=340
Edit1.Height  :=14
Edit1.BorderStyle :=bsnone;
Edit1.Font.Color:=clBlack
Edit1.Font.Name:='微软雅黑'
Edit1.OnChange:=@Editchanged;

//“立即安装”按钮
nextbtn1:=BtnCreate(WizardForm.Handle,199,230,188,58,ExpandConstant('{tmp}\install.png'),1,False);
BtnSetEvent(nextbtn1,BtnClickEventID,WrapBtnCallback(@NextBtn1Click,1));
BtnSetFontColor(nextbtn1,clWhite,clWhite,clWhite,clWhite);

//浏览
DirBrowseBtn:=BtnCreate(WizardForm.Handle,504,305,60,20,ExpandConstant('{tmp}\change.png'),1,False);
BtnSetEvent(DirBrowseBtn,BtnClickEventID,WrapBtnCallback(@EditdirOnClick,1));
BtnSetFont(DirBrowseBtn,WFButtonFont.Handle);
BtnSetFontColor(DirBrowseBtn,clWhite,clblack,clblack,clblack);
BtnSetText(DirBrowseBtn,ExpandConstant('更改'));
//**************磁盘大小显示*******************
WelTx1 := TLabel.Create(WizardForm);
WelTx1.AutoSize:=False;
WelTx1.SetBounds(18, 328, ScaleX(500), ScaleY(17));
WelTx1.Transparent:=True;
WelTx1.Font.Color :=clSilver;
WelTx1.Font.Size := 10
WelTx1.Font.Name:= '微软雅黑';
WelTx1.Caption := ExpandConstant('所需空间: ') + MbOrTB(176.62);
WelTx1.Parent := WizardForm;

WelTx2 := TLabel.Create(WizardForm);
WelTx2.AutoSize:=False;
WelTx2.SetBounds(160,328, ScaleX(500), ScaleY(17));
WelTx2.Transparent:=True;
WelTx2.Font.Color :=clSilver;
WelTx2.Font.Size := 10
WelTx2.Font.Name:= '微软雅黑';
WelTx2.Parent := WizardForm;
if GetSpaceOnDisk(ExtractFileDrive(WizardForm.DirEdit.Text), True, FreeMB, TotalMB) then
begin
WelTx2.Caption:=ExpandConstant('可用空间: ') + MbOrTB(FreeMB);
end;
WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption; //更换磁盘后相应事件
//**************磁盘大小显示*******************


//百分比
PrLabel:=TLabel.Create(WizardForm);
PrLabel.Parent:=WizardForm;
PrLabel.Left:=27+48;
PrLabel.Top:=312;;                  //百分比
PrLabel.Transparent:=True;
PrLabel.Font.Name:='微软雅黑';
PrLabel.Font.Color:=clwhite;
PrLabel1:=TLabel.Create(WizardForm);
PrLabel1.Parent:=WizardForm;
PrLabel1.Left:=20;
PrLabel1.Top:=312;
PrLabel1.Caption:='正在安装';
PrLabel1.Transparent:=True;
PrLabel1.Font.Name:='微软雅黑';
PrLabel1.Font.Color:=clwhite;
PBOldProc:=SetWindowLong(WizardForm.ProgressGauge.Handle,-4,PBCallBack(@PBProc,4));


end;

//**************取消对话框************************
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
var
  CancelLabel2: Tlabel;
  CancelLabel3: Tlabel;
begin
  Cancel := False;
  Confirm := False;
  CancelForm := CreateCustomForm();
  CancelForm.Width := ScaleX(350);        //退出安装对话框大小
  CancelForm.Height := ScaleY(181+15);
  CancelForm.BorderStyle:=bsNone;
  CancelForm.CenterInsideControl(WizardForm, False);
  CancelForm.OnMouseDown:=@CancelFormMouseDown;
  CancelImage:=ImgLoad(CancelForm.Handle,ExpandConstant('{tmp}\bg_cancel.png'),(0),(0),350,181,True,True);   //退出安装对话框 图片
  ShapeForm(CancelForm, radius);
  //关闭按钮
  CancelCloseBtn:=BtnCreate(CancelForm.Handle,316,3,30,31,ExpandConstant('{tmp}\close.png'),3,False); //退出安装对话框右上角 按钮
  BtnSetEvent(CancelCloseBtn,BtnClickEventID,WrapBtnCallback(@CancelCloseBtnOnClick,1));
  //确认键反馈
  OKButton := TButton.Create(CancelForm);
  OKButton.Parent := CancelForm;
  OKButton.ModalResult := mrOk;
  OKButton.SetBounds(0, 0, 0, 0);
  //退出安装“确定”按钮
  OKBtn:=BtnCreate(CancelForm.Handle,172,144,80,26,ExpandConstant('{tmp}\cancel_ok.png'),1,False);
  BtnSetEvent(OKBtn,BtnClickEventID,WrapBtnCallback(@OKBtnOnClick,1));
  BtnSetFont(OKBtn,WFButtonFont.Handle);
  BtnSetFontColor(OKBtn,clwhite,clwhite,clwhite,clwhite);       //字体颜色
  BtnSetText(OKBtn,ExpandConstant('确定'));
  //退出安装“取消”按钮
  CancelFormBtn:=BtnCreate(CancelForm.Handle,262,144,80,26,ExpandConstant('{tmp}\cancel_back.png'),1,False);
  BtnSetEvent(CancelFormBtn,BtnClickEventID,WrapBtnCallback(@CancelBtnOnClick,1));
  BtnSetFont(CancelFormBtn,WFButtonFont.Handle);
  BtnSetFontColor(CancelFormBtn,clwhite,clwhite,clwhite,clwhite);        //字体颜色
  BtnSetText(CancelFormBtn,ExpandConstant('取消'));

  ImgApplyChanges(CancelForm.Handle);

  if CancelForm.ShowModal = mrOK then
  begin
   Cancel := True;
  end
 
end;

//****************页面切换****************
procedure CurPageChanged(CurPageID: Integer);
begin
  WizardForm.NextButton.Width:=0;
  WizardForm.NextButton.TabStop:=false
  WizardForm.CancelButton.Width:=0;
  WizardForm.CancelButton.TabStop:=false
  WizardForm.BackButton.Width:=0;
  WizardForm.BackButton.TabStop:=false
  BtnSetVisibility(backBtn,false);BtnSetVisibility(DirBrowseBtn,false);
  BtnSetVisibility(Startbtn,false);BtnSetVisibility(MinBtn,True);
  WelTx1.hide;WelTx2.hide;
  Edit1.hide;
  PrLabel.hide;PrLabel1.hide;
  BtnSetVisibility(nextbtn1,false);
if CurPageID = wpWelcome then
  begin
  WizardFormImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg01t.png'),(-10), (-10),602,380,True,True);
  BtnSetVisibility(nextbtn1,true);
  BtnSetVisibility(Startbtn,true);
  BtnSetVisibility(DirBrowseBtn,true);
  Edit1.show;
  WelTx1.show;WelTx2.show;
  end;
if CurPageID = wpInstalling then
  begin
  WizardFormImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg02t.png'),(-10), (-10),602,380,True,True);
  pbbgImg:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\Pbbg.png'),20,327,544,25,True,True);
  pbImg:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\Pbjd.png'),0,0,99,25,True,True);
  InstallingImage := NewWebWnd(WizardForm.Handle,0,56,582,231);
  DisplayHTMLPage(InstallingImage, ExpandConstant('{tmp}\InstallingImage.htm'));
  WebWndSetParent(InstallingImage, WizardForm.Handle)
  PrLabel.show;PrLabel1.show;
  end;
if CurPageID = wpFinished then
  begin
  WebWndSetParent(InstallingImage, WizardForm.FinishedPage.Handle);
  ImgSetVisibility(pbImg,false);ImgSetVisibility(pbbgImg,false);
  WizardFormImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg03t.png'),(-10), (-10),602,380,True,True);
  Finbtn:=BtnCreate(WizardForm.Handle,195,297,188,58,ExpandConstant('{tmp}\finish.png'),1,False) //完成按钮
  BtnSetEvent(Finbtn,BtnClickEventID,WrapBtnCallback(@FinbtnClick,1));
  BtnSetEvent(CancelBtn,BtnClickEventID,WrapBtnCallback(@FinbtnClick,1));
  end;
 
ImgApplyChanges(WizardForm.Handle);
end;

procedure DeinitializeSetup();
begin
gdipShutdown;  //背景图
if PBOldProc<>0 then SetWindowLong(WizardForm.ProgressGauge.Handle,-4,PBOldProc);
end;

//安装结束,点"完成"之后运行程序
procedure CurStepChanged(CurStep: TSetupStep);
var
RCode: Integer;
begin
if (CurStep=ssDone)then
     Exec(ExpandConstant('{app}\Program\Thunder.exe'), '', '', SW_SHOW, ewNoWait, RCode);
end;

你可能感兴趣的:(inno setup pplive yang)