#define MyAppName "迅雷7"
#define MyAppExeName"迅雷7"
#define MyAppVersion "1.0.0.0"
[Setup]
AppName={#MyAppName}
AppVersion={#MyAppName}
AppVerName={#MyAppName}
AppPublisher={#MyAppName}
DefaultDirName={pf}\Thunder\迅雷7
DefaultGroupName={#MyAppName}
OutputDir=.
OutputBaseFilename={#MyAppName}
SetupIconFile=install.ico
UninstallIconFile=Uninstall.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\迅雷软件\{#MyAppName}\{#MyAppName}; Filename: {app}\Program\Thunder.exe; WorkingDir: {app}; Check: StartMenu;
//开始菜单快捷方式
Name: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\迅雷软件\{#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:"xunleirun";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';
//窗口圆角
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;
WelTx2,PrLabel,PrLabel1:Tlabel;
//硬盘显示
FreeMB,TotalMB: Cardinal;
PBOldProc : Longint;
//
IsFrameDragging : boolean;
dx,dy,dh1 : integer;
Frame : TForm;
//百分比
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);
ImgSetPosition(pbImg,26,304,w,16);
ImgSetVisiblePart(pbImg,0,0,w,16);
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}\window0.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 NextBtnClick(hBtn:HWND);
begin
WizardFormImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\window1c.png'),(-10),(-10),607,457,True,True);
WizardFormImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\DirImg.png'),26,273,446,36,True,True);
BtnSetVisibility(backBtn,true);BtnSetVisibility(NextBtn,false);
BtnSetVisibility(Startbtn,false);BtnSetVisibility(DirBrowseBtn,true);
BtnSetVisibility(MinBtn,false);
BtnSetVisibility(nextbtn1,true);
BtnSetVisibility(A2Check,true);
BtnSetVisibility(A3Check,false);BtnSetVisibility(A4Check,true);
BtnSetVisibility(A5Check,true);
Label2.Hide;Label3.Hide;
Edit1.show;Label4.show;
Label5.show;Label6.show;Label7.show;
Label8.hide;Label9.hide;
Label10.hide;
WelTx2.show;
ImgApplyChanges(WizardForm.Handle);
end;
//返回按钮,返回第一页
procedure backBtnClick(hBtn:HWND);
begin
WizardFormImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\windowc.png'),(-10),(-10),607,457,True,True);
BtnSetVisibility(backBtn,false);BtnSetVisibility(Startbtn,true);
BtnSetVisibility(NextBtn,true);BtnSetVisibility(DirBrowseBtn,false);
BtnSetVisibility(MinBtn,True);BtnSetVisibility(nextbtn1,false);
WelTx2.hide;
Label2.show;Label3.show;
Edit1.hide;Label4.hide;
Label8.hide;Label9.hide;
Label10.hide;
Label5.hide;Label6.hide;Label7.hide;
BtnSetVisibility(A2Check,false);
BtnSetVisibility(A3Check,true);BtnSetVisibility(A4Check,false);
BtnSetVisibility(A5Check,false);
ImgApplyChanges(WizardForm.Handle)
end;
//“许可协议”按钮点击石事件
procedure XYClick(Sender: TObject);
var
ErrorCode: Integer;
begin
ShellExec('open','http://www.xunlei.com/xieyi/xl7.html','','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
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;
//协议勾选框点击事件
procedure label2click(sender :TObject);
begin
BtnSetChecked(A3Check, not BtnGetChecked(A3Check));
if BtnGetChecked(A3Check) then
begin
BtnSetEnabled(StartBtn,true);BtnSetEnabled(NextBtn,true);
end else
begin
BtnSetEnabled(StartBtn,false);BtnSetEnabled(NextBtn,false);
end
end;
//勾选框文字点击事件
procedure label4click(sender :TObject);
begin
BtnSetChecked(A2Check, not BtnGetChecked(A2Check));
end;
procedure label6click(sender :TObject);
begin
BtnSetChecked(A4Check, not BtnGetChecked(A4Check));
end;
procedure label7click(sender :TObject);
begin
BtnSetChecked(A5Check, not BtnGetChecked(A5Check));
end;
procedure label8click(sender :TObject);
begin
BtnSetChecked(A6Check, not BtnGetChecked(A6Check));
end;
procedure label9click(sender :TObject);
begin
BtnSetChecked(A7Check, not BtnGetChecked(A7Check));
end;
procedure label10click(sender :TObject);
begin
BtnSetChecked(A8Check, not BtnGetChecked(A8Check));
end;
//************注册表*********************
Function regedit(): Boolean;
begin
if BtngetChecked(A5Check) = True then
Result :=BtngetChecked(A5Check)
end;
//***********添加桌面快捷方式***************
Function desktop(): Boolean;
begin
if BtngetChecked(A2Check) = True then
Result :=BtngetChecked(A2Check)
end;
//************开始菜单栏*************
Function StartMenu(): Boolean;
begin
if BtngetChecked(A2Check) = True then
Result :=BtngetChecked(A2Check)
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
if PageID=wpSelectComponents then //跳过组件安装界面
result := true;
end;
procedure InitializeWizard();
begin
ExtractTemporaryFile('btn_by.png');
ExtractTemporaryFile('btn_n.png');
ExtractTemporaryFile('CheckButton.png');
ExtractTemporaryFile('backbtn.png');
ExtractTemporaryFile('btn_cancel.png');
ExtractTemporaryFile('btn_s1.png');
ExtractTemporaryFile('btn_s2.png');
ExtractTemporaryFile('btn_min.png');
ExtractTemporaryFile('btn_close.png');
ExtractTemporaryFile('window0.png');
//ExtractTemporaryFile('window.png');
ExtractTemporaryFile('windowc.png');
//ExtractTemporaryFile('window1.png');
ExtractTemporaryFile('window1c.png');
//ExtractTemporaryFile('window2.png');
ExtractTemporaryFile('window2c.png');
//ExtractTemporaryFile('window3.png');
ExtractTemporaryFile('window3c.png');
ExtractTemporaryFile('DirImg.png');
ExtractTemporaryFile('Pbbg.png');
ExtractTemporaryFile('Pbjd.png');
ExtractTemporaryFile('btn_ok.png');
ExtractTemporaryFile('MessageDlgBkg.png');
//ExtractTemporaryFile('MessageDlgBkgc.png');
ExtractTemporaryFile('MessageDlgAlert.png');
ExtractTemporaryFile('btn_finished.png');
WizardForm.BorderStyle:=bsnone
//主界面框大小
WizardForm.Width:=587
WizardForm.Height:=437
WizardForm.OnMouseDown:=@WizardFormMouseDown;
WizardFormcc;
CreateFrame;
//ShapeForm(WizardForm, radius);//圆角
//SetClassLong:=(Wizard.Handle,-26,GetWindowLong(WinzardForm.Handle,-26)+$20000);
WizardFormImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\windowc.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,530,8,22,22,ExpandConstant('{tmp}\Btn_min.png'),3,False);
BtnSetEvent(MinBtn,BtnClickEventID,WrapBtnCallback(@MinBtnOnClick,1));
//取消按钮
CancelBtn:=BtnCreate(WizardForm.Handle,555,8,22,22,ExpandConstant('{tmp}\btn_close.png'),1,False)
BtnSetEvent(CancelBtn,BtnClickEventID,WrapBtnCallback(@CancelBtnClick,1));
//**************第一页字体和按钮******************
Label1 := TLabel.Create(WizardForm);
Label1.Parent := WizardForm;
Label1.Caption := '{#MyAppName}';
Label1.Transparent := true;
Label1.Font.Size:=10
Label1.Font.Name:='微软雅黑'
Label1.Font.Color:=clSilver
Label1.Left := (15);
Label1.Top := (10);
Label2 := TLabel.Create(WizardForm);
Label2.Parent := WizardForm;
Label2.Caption := '已阅读并同意迅雷软件';
Label2.Transparent := true;
Label2.Font.Size:=9
Label2.Font.Name:='微软雅黑'
Label2.Font.Color:=$002A2A2A
Label2.Left := (38);
Label2.Top := (400);
Label2.OnClick:=@label2click;
Label3 := TLabel.Create(WizardForm);
Label3.Parent := WizardForm;
Label3.Caption := '许可协议';
Label3.Transparent := true;
Label3.Font.Size:=9
Label3.Font.Name:='微软雅黑'
Label3.Font.Color:=$00EBAD44
Label3.Left := 163;
Label3.Top := Label2.Top;
Label3.OnClick:=@XYClick;
//“快速安装”按钮
Startbtn:=BtnCreate(WizardForm.Handle,190,307,210,59,ExpandConstant('{tmp}\btn_s1.png'),1,False);
BtnSetEvent(Startbtn,BtnClickEventID,WrapBtnCallback(@NextBtn1Click,1));
//协议前勾选按钮
A3Check:=BtnCreate(WizardForm.Handle,17,401,15,15,ExpandConstant('{tmp}\CheckButton.png'),1,true);
BtnSetChecked(A3Check,true);
//自定义安装按钮
NextBtn:=BtnCreate(WizardForm.Handle,470,400,91,14,ExpandConstant('{tmp}\btn_n.png'),1,False);
BtnSetEvent(NextBtn,BtnClickEventID,WrapBtnCallback(@NextBtnClick,1));
BtnSetFontColor(NextBtn,clBlack,clBlack,clBlack,clGray);
//**************第一页字体和按钮******************
//**************磁盘大小显示*******************
WelTx2 := TLabel.Create(WizardForm);
WelTx2.AutoSize:=False;
WelTx2.SetBounds(86,245, ScaleX(500), ScaleY(17));
WelTx2.Transparent:=True;
WelTx2.Font.Color :=clSilver;
WelTx2.Font.Size := 9
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; //更换磁盘后相应事件
//**************磁盘大小显示*******************
//**************第二页字体和按钮******************
Edit1 := TEdit.Create(WizardForm);
Edit1.Parent := WizardForm;
Edit1.Text := WizardForm.DirEdit.Text;//自定义目录文字
Edit1.Font.Size:=9
Edit1.Left := 35;
Edit1.Top := 285 ;
Edit1.Width :=340
Edit1.Height :=14
Edit1.BorderStyle :=bsnone;
Edit1.Font.Color:=clBlack
Edit1.Font.Name:='微软雅黑'
Edit1.OnChange:=@Editchanged;
Label4 := TLabel.Create(WizardForm);
Label4.Parent := WizardForm;
Label4.Caption := '添加桌面快捷方式';
Label4.Transparent := true;
Label4.Font.Size:=9
Label4.Font.Name:='微软雅黑'
Label4.Font.Color:=$002A2A2A
Label4.Left := 51;
Label4.Top := 322;
Label4.OnClick:=@label4click;
Label5 :=TLabel.Create(WizardForm);
Label5.Parent := WizardForm;
Label5.Caption := '安装位置:';
Label5.Transparent := true;
Label5.Font.Size:=9
Label5.Font.Name:='微软雅黑'
Label5.Font.Color:=clblack;
Label5.Left := 27;
Label5.Top := 245;
Label6 := TLabel.Create(WizardForm);
Label6.Parent := WizardForm;
Label6.Caption := '添加多浏览器支持';
Label6.Transparent := true;
Label6.Font.Size:=9
Label6.Font.Name:='微软雅黑'
Label6.Font.Color:=$002A2A2A
Label6.Left := 217;
Label6.Top := 322;
Label6.OnClick:=@label6click;
Label7 := TLabel.Create(WizardForm);
Label7.Parent := WizardForm;
Label7.Caption := '开机启动迅雷7';
Label7.Transparent := true;
Label7.Font.Size:=9
Label7.Font.Name:='微软雅黑'
Label7.Font.Color:=$002A2A2A
Label7.Left := 382;
Label7.Top := 322;
Label7.OnClick:=@label7click;
//“立即安装”按钮
nextbtn1:=BtnCreate(WizardForm.Handle,395,389,95,29,ExpandConstant('{tmp}\btn_s2.png'),1,False);
BtnSetEvent(nextbtn1,BtnClickEventID,WrapBtnCallback(@NextBtn1Click,1));
BtnSetFontColor(nextbtn1,clWhite,clWhite,clWhite,clWhite);
//浏览
DirBrowseBtn:=BtnCreate(WizardForm.Handle,470,273,94,36,ExpandConstant('{tmp}\btn_by.png'),1,False);
BtnSetEvent(DirBrowseBtn,BtnClickEventID,WrapBtnCallback(@EditdirOnClick,1));
BtnSetFontColor(DirBrowseBtn,Clblack,Clblack,Clblack,$B6B6B6);
//返回按钮
backBtn:=BtnCreate(WizardForm.Handle,498,389,64,29,ExpandConstant('{tmp}\backBtn.png'),1,False);
BtnSetEvent(backBtn,BtnClickEventID,WrapBtnCallback(@backBtnClick,1));
BtnSetFontColor(backBtn,clBlack,clBlack,clBlack,clGray);
//快捷方式够选框
A2Check:=BtnCreate(WizardForm.Handle,30,324,15,15,ExpandConstant('{tmp}\CheckButton.png'),1,True);
A4Check:=BtnCreate(WizardForm.Handle,194,324,15,15,ExpandConstant('{tmp}\CheckButton.png'),1,True);
A5Check:=BtnCreate(WizardForm.Handle,359,324,15,15,ExpandConstant('{tmp}\CheckButton.png'),1,True);
//快捷方式够选框,默认勾选
BtnSetChecked(A2Check,true);
BtnSetChecked(A4Check,true);
BtnSetChecked(A5Check,true);
ImgApplyChanges(WizardForm.Handle);
//**************第二页字体和按钮******************
//百分比
PrLabel:=TLabel.Create(WizardForm);
PrLabel.Parent:=WizardForm;
PrLabel.Left:=27+48;
PrLabel.Top:=281;; //百分比
PrLabel.Transparent:=True;
PrLabel.Font.Name:='微软雅黑';
PrLabel1:=TLabel.Create(WizardForm);
PrLabel1.Parent:=WizardForm;
PrLabel1.Left:=27;
PrLabel1.Top:=281;;
PrLabel1.Caption:='正在安装';
PrLabel1.Transparent:=True;
PrLabel1.Font.Name:='微软雅黑';
PBOldProc:=SetWindowLong(WizardForm.ProgressGauge.Handle,-4,PBCallBack(@PBProc,4));
//**********安装完成界面*****************
Label8 := TLabel.Create(WizardForm);
Label8.Parent := WizardForm;
Label8.Caption := '360安全导航';
Label8.Transparent := true;
Label8.Font.Size:=10
Label8.Font.Name:='微软雅黑'
Label8.Font.Color:=$002A2A2A
Label8.Left := 55;
Label8.Top := 281;
Label8.OnClick:=@label8click;
Label9 := TLabel.Create(WizardForm);
Label9.Parent := WizardForm;
Label9.Caption := '360安全卫士';
Label9.Transparent := true;
Label9.Font.Size:=10
Label9.Font.Name:='微软雅黑'
Label9.Font.Color:=$002A2A2A
Label9.Left := 55+140;
Label9.Top := 281;
Label9.OnClick:=@label9click;
Label10 := TLabel.Create(WizardForm);
Label10.Parent := WizardForm;
Label10.Caption := '百度7工具栏';
Label10.Transparent := true;
Label10.Font.Size:=10
Label10.Font.Name:='微软雅黑'
Label10.Font.Color:=$002A2A2A
Label10.Left := 55+140+144;
Label10.Top := 281;
Label10.OnClick:=@label10click;
Label11 := TLabel.Create(WizardForm);
Label11.Parent := WizardForm;
Label11.Caption := '安全上网导航';
Label11.Transparent := true;
Label11.Font.Size:=10
Label11.Font.Name:='微软雅黑'
Label11.Font.Color:=clGray
Label11.Left := 55;
Label11.Top := 303;
Label12 := TLabel.Create(WizardForm);
Label12.Parent := WizardForm;
Label12.Caption := '永久加固保护XP';
Label12.Transparent := true;
Label12.Font.Size:=10
Label12.Font.Name:='微软雅黑'
Label12.Font.Color:=clGray
Label12.Left := 55+140;
Label12.Top := 303;
Label13 := TLabel.Create(WizardForm);
Label13.Parent := WizardForm;
Label13.Caption := '让IE更强大!';
Label13.Transparent := true;
Label13.Font.Size:=10
Label13.Font.Name:='微软雅黑'
Label13.Font.Color:=clGray
Label13.Left := 55+140+144;
Label13.Top := 303;
end;
//**************取消对话框************************
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
var
CancelLabel2: Tlabel;
CancelLabel3: Tlabel;
begin
Cancel := False;
Confirm := False;
CancelForm := CreateCustomForm();
CancelForm.Width := ScaleX(375); //退出安装对话框大小
CancelForm.Height := ScaleY(167);
CancelForm.BorderStyle:=bsNone;
CancelForm.CenterInsideControl(WizardForm, False);
CancelForm.OnMouseDown:=@CancelFormMouseDown;
CancelImage:=ImgLoad(CancelForm.Handle,ExpandConstant('{tmp}\MessageDlgBkg.png'),(0),(0),374,153,True,True); //退出安装对话框 图片
IconI:=ImgLoad(CancelForm.Handle,ExpandConstant('{tmp}\MessageDlgAlert.png'),10,44,54,54,True,True);
ShapeForm(CancelForm, radius);
//关闭按钮
CancelCloseBtn:=BtnCreate(CancelForm.Handle,348,3,22,22,ExpandConstant('{tmp}\btn_close.png'),3,False); //退出安装对话框右上角 按钮
BtnSetEvent(CancelCloseBtn,BtnClickEventID,WrapBtnCallback(@CancelCloseBtnOnClick,1));
//退出框中文字
CancelLabel2:= TLabel.Create(CancelForm);
CancelLabel2.AutoSize:=False;
CancelLabel2.Font.Name :='微软雅黑'
CancelLabel2.Font.Size :=9
CancelLabel2.Font.Color:=clBlack
CancelLabel2.Parent:=CancelForm;
CancelLabel2.WordWrap := True;
CancelLabel2.SetBounds(ScaleX(73), ScaleY(63), ScaleY(225), ScaleY(50));
CancelLabel2.OnMouseDown:=@CancelFormMouseDown;
CancelLabel2.Transparent:=True;
CancelLabel2.Caption := '您确定要退出迅雷安装过程?';
//退出框左上角文字
CancelLabel3:= TLabel.Create(CancelForm);
CancelLabel3.Parent:=CancelForm;
CancelLabel3.Transparent:=True;
CancelLabel3.Font.Name :='微软雅黑'
CancelLabel3.Font.Size := 9
CancelLabel3.Font.Color:=clBlack
CancelLabel3.AutoSize:=False;
CancelLabel3.WordWrap := True;
CancelLabel3.SetBounds(ScaleX(10), ScaleY(5), ScaleY(250), ScaleY(50));
CancelLabel3.OnMouseDown:=@CancelFormMouseDown;
CancelLabel3.Caption := '提示';
//确认键反馈
OKButton := TButton.Create(CancelForm);
OKButton.Parent := CancelForm;
OKButton.ModalResult := mrOk;
OKButton.SetBounds(0, 0, 0, 0);
//退出安装“确定”按钮
OKBtn:=BtnCreate(CancelForm.Handle,219,118,72,24,ExpandConstant('{tmp}\btn_ok.png'),1,False);
BtnSetEvent(OKBtn,BtnClickEventID,WrapBtnCallback(@OKBtnOnClick,1));
BtnSetFontColor(OKBtn,clBlack,clBlack,clBlack,$B6B6B6); //字体颜色
//退出安装“取消”按钮
CancelFormBtn:=BtnCreate(CancelForm.Handle,219+74,118,72,24,ExpandConstant('{tmp}\btn_cancel.png'),1,False);
BtnSetEvent(CancelFormBtn,BtnClickEventID,WrapBtnCallback(@CancelBtnOnClick,1));
BtnSetFontColor(CancelFormBtn,clBlack,clBlack,clBlack,$B6B6B6); //字体颜色
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(NextBtn,false);BtnSetVisibility(Startbtn,false);
BtnSetVisibility(A2Check,false);
BtnSetVisibility(A3Check,false);BtnSetVisibility(A4Check,false);
BtnSetVisibility(A5Check,false);
BtnSetVisibility(MinBtn,True);
WelTx2.hide;
Edit1.hide;
PrLabel.hide;PrLabel1.hide;
Label4.hide;Label5.hide;
Label6.hide;Label7.hide;
Label8.hide;Label9.hide;
Label10.hide;Label11.hide;
Label12.hide;Label13.hide;
BtnSetVisibility(nextbtn1,false);
PrLabel.hide;PrLabel1.hide;
if CurPageID = wpWelcome then
begin
WizardFormImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\windowc.png'),(-10), (-10),607,457,True,True);
BtnSetVisibility(A3Check,true);
BtnSetVisibility(NextBtn,true)
BtnSetVisibility(Startbtn,true)
end;
if CurPageID = wpSelectDir then
begin
WizardFormImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\window1c.png'),(-10),(-10),607,457,True,True);
WizardFormImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\DirImg.png'),26,273,446,36,True,True);
BtnSetVisibility(backBtn,true);BtnSetVisibility(NextBtn,false);
BtnSetVisibility(Startbtn,false);BtnSetVisibility(DirBrowseBtn,true);
BtnSetVisibility(MinBtn,false);
BtnSetVisibility(nextbtn1,true);
BtnSetVisibility(A2Check,true);
BtnSetVisibility(A3Check,false);BtnSetVisibility(A4Check,true);
BtnSetVisibility(A5Check,true);
Label2.Hide;Label3.Hide;
Edit1.show;WelTx2.show;
Label4.show;Label5.show;
Label6.show;Label7.show;
Label8.hide;Label9.hide;
Label10.hide;Label11.hide;
Label12.hide;Label13.hide;
ImgApplyChanges(WizardForm.Handle);
end;
if CurPageID = wpInstalling then
begin
WizardFormImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\window2c.png'),(-10), (-10),607,457,True,True);
pbbgImg:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\Pbbg.png'),26,304,539,16,True,True);
pbImg:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\Pbjd.png'),26,304,539,16,True,True);
Label2.hide;
Label3.Hide;
PrLabel.show;PrLabel1.show;
end;
if CurPageID = wpFinished then
begin
WizardFormImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\window3c.png'),(-10), (-10),607,457,True,True);
Finbtn:=BtnCreate(WizardForm.Handle,190,354,211,59,ExpandConstant('{tmp}\btn_finished.png'),1,False) //完成按钮
BtnSetEvent(Finbtn,BtnClickEventID,WrapBtnCallback(@FinbtnClick,1));
A6Check:=BtnCreate(WizardForm.Handle,35,279,15,15,ExpandConstant('{tmp}\CheckButton.png'),1,True);
A7Check:=BtnCreate(WizardForm.Handle,35+140,279,15,15,ExpandConstant('{tmp}\CheckButton.png'),1,True);
A8Check:=BtnCreate(WizardForm.Handle,35+140+145,279,15,15,ExpandConstant('{tmp}\CheckButton.png'),1,True);
BtnSetChecked(A6Check,true);
BtnSetChecked(A7Check,true);
BtnSetChecked(A8Check,true);
Label8.show;Label9.show;
Label10.show;Label11.show;
Label12.show;Label13.show;
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;