[code]
type
TImgPB = record
Left, Top, Width, Height, MaxWidth : integer;
img1,img2 : Longint;
end;
var
UninstPB: TImgPB;
UninstPBOldProc: Longint;
UFCaption: string;
ProgressInfoLabel, Uninstalling, StatusUninstLabel, UninstPageDescriptLabel, WizardUninstLabel: TLabel;
uCancelUninstBtn: HWND;
ButtonFont: TFont;
u:HWND;
#include "botva2u.iss"
procedure LoadSkinUninst(lpszPath: string; lpszIniFileName: string ); external 'LoadSkin@{tmp}\ISSkin.dll stdcall delayload uninstallonly';
procedure UnloadSkinUninst(); external 'UnloadSkin@{tmp}\ISSkin.dll stdcall delayload uninstallonly';
(*
function UninstPBProc(h:hWnd;Msg,wParam,lParam:Longint):Longint;
var
pr,i1,i2:Extended;
p:string;
begin
if Msg=$2 then SetWindowLong(h,-4,UninstPBOldProc);
Result:=CallWindowProc(UninstPBOldProc,h,Msg,wParam,lParam);
if (Msg=$402) and (UninstallProgressForm.ProgressBar.Position>UninstallProgressForm.ProgressBar.Min) then begin
i1:=UninstallProgressForm.ProgressBar.Position-UninstallProgressForm.ProgressBar.Min;
i2:=UninstallProgressForm.ProgressBar.Max-UninstallProgressForm.ProgressBar.Min;
pr:=(i1*100)/i2;
p:=' - ['+Format('%f',[pr])+'%]';
StringChange(p,',','.');
UninstallProgressForm.Caption:=UFCaption+p;
end;
end;
*)
//=====================[Подключение скина к деинсталлятору - начало]=====================
function InitializeUninstall(): Boolean;
begin
if not FileExists(ExpandConstant('{tmp}\WizardImage.jpg')) then FileCopy(ExpandConstant('{app}\Uninstall\WizardImage.jpg'), ExpandConstant('{tmp}\WizardImage.jpg'), False);
if not FileExists(ExpandConstant('{tmp}\pb.png')) then FileCopy(ExpandConstant('{app}\Uninstall\pb.png'), ExpandConstant('{tmp}\pb.png'), False);
if not FileExists(ExpandConstant('{tmp}\pbbkg.png')) then FileCopy(ExpandConstant('{app}\Uninstall\pbbkg.png'), ExpandConstant('{tmp}\pbbkg.png'), False);
if not FileExists(ExpandConstant('{tmp}\botva2.dll')) then FileCopy(ExpandConstant('{app}\Uninstall\botva2.dll'), ExpandConstant('{tmp}\botva2.dll'), False);
if not FileExists(ExpandConstant('{tmp}\InnoCallback.dll')) then FileCopy(ExpandConstant('{app}\Uninstall\InnoCallback.dll'), ExpandConstant('{tmp}\InnoCallback.dll'), False);
if not FileExists(ExpandConstant('{tmp}\ISSkin.dll')) then FileCopy(ExpandConstant('{app}\Uninstall\ISSkin.dll'), ExpandConstant('{tmp}\ISSkin.dll'), False);
if not FileExists(ExpandConstant('{tmp}\Cancel.png')) then FileCopy(ExpandConstant('{app}\Uninstall\close.png'), ExpandConstant('{tmp}\close.png'), False);
if not FileExists(ExpandConstant('{tmp}\Crysis.cjstyles')) then FileCopy(ExpandConstant('{app}\Uninstall\Crysis.cjstyles'), ExpandConstant('{tmp}\Crysis.cjstyles'), False);
LoadSkinUninst(ExpandConstant('{tmp}\Crysis.cjstyles'), '');
Result:=True;
end;
//=====================[Подключение скина к деинсталлятору - конец]=====================
////////////////////// UninstallingPage //////////////////////
procedure InitializeUninstallProgressForm;
begin
with UninstallProgressForm do
begin
ClientWidth:=ScaleX(648);
ClientHeight:=ScaleY(390);
BorderStyle:=bsSingle;
// BorderIcons:=[biSystemMenu]
OuterNotebook.Hide;
InnerNotebook.Hide;
Bevel.Hide;
Center;
// ImgLoadBotvaU(u,ExpandConstant('{tmp}\WizardImage.jpg'),0,0,648,390,true,true);
WizardUninstLabel:= TLabel.Create(UninstallProgressForm);
with WizardUninstLabel do begin
AutoSize:=False;
SetBounds(ScaleX(215), ScaleY(232), ScaleX(650), ScaleY(65));
Transparent:=True;
Font.Name:= {#FontName};
Font.Size:= 13;
Font.Color:={#FontColor};
Font.Style:=[fsBold];
Caption:= ExpandConstant('{cm:WizardUninst}'); // Состояние удаления
Parent := UninstallProgressForm;
end;
UninstPageDescriptLabel := TLabel.Create(UninstallProgressForm);
with UninstPageDescriptLabel do begin
AutoSize:=False;
SetBounds(ScaleX(100), ScaleY(215), ScaleX(600), ScaleY(50));
WordWrap:= True;
Transparent:=True;
Font.Name:= {#FontName};
Font.Size:= 10;
Font.Color:={#FontColor};
Font.Style:=[fsBold, fsItalic];
Caption:= ExpandConstant('{cm:UninstDescript}'); // Подождите, пока игра будет удалена с Вашего компьютера.
Parent := UninstallProgressForm;
end;
StatusUninstLabel := TLabel.Create(UninstallProgressForm);
with StatusUninstLabel do begin
AutoSize:=False;
SetBounds(ScaleX(120), ScaleY(250), ScaleX(560), ScaleY(17));
Transparent:=True;
Font.Name:= {#FontName};
Font.Size:= 10;
Font.Color:={#FontColor};
Font.Style:=[fsBold, fsItalic];
Caption:= ExpandConstant('{cm:StatusUninst}'); // Удаление игры ...
Parent := UninstallProgressForm;
end;
Uninstalling := TLabel.Create(UninstallProgressForm);
with Uninstalling do begin
AutoSize:=False;
SetBounds(ScaleX(570), ScaleY(96), ScaleX(114), ScaleY(20));
Transparent:=True;
Font.Name:= {#FontName};
Font.Size:= 10;
Font.Color:={#FontColor};
Font.Style:=[fsBold];
Caption := ExpandConstant('{cm:Uninstalling}'); //Удаление
Parent := UninstallProgressForm;
end;
ProgressInfoLabel := TLabel.Create(UninstallProgressForm);
with ProgressInfoLabel do begin
AutoSize:=False;
SetBounds(ScaleX(120), ScaleY(355), ScaleX(560), ScaleY(17));
Alignment := taCenter;
Transparent:=True;
Font.Name:= {#FontName};
Font.Size:= 10;
Font.Color:={#FontColor};
Font.Style:=[fsBold,fsItalic];
Parent := UninstallProgressForm;
end;
u:=UninstallProgressForm.Handle;
ImgLoadBotvaU(u,ExpandConstant('{tmp}\WizardImage.jpg'),ScaleX(0),ScaleY(0),UninstallProgressForm.ClientWidth,UninstallProgressForm.ClientHeight,True,True);
ImgLoadBotvaU(u,ExpandConstant('{tmp}\pbbkg.png'),119,300,560,25,True,True);
// ButtonFont:=TFont.Create;
ButtonFont.Style:=[fsBold];
UninstallProgressForm.CancelButton.Visible:=False;
with UninstallProgressForm.CancelButton do begin
uCancelUninstBtn:=BtnCreateBotvaU(u,ScaleX(370),ScaleY(38),ScaleX(47),ScaleY(39),ExpandConstant('{tmp}\close.png'),1,False);
BtnSetTextBotvaU(uCancelUninstBtn, UninstallProgressForm.CancelButton.Caption);
BtnSetFontU(uCancelUninstBtn,ButtonFont.Handle);
BtnSetFontColorBotvaU(uCancelUninstBtn,{#FontColor},$FFFFFF,$FFFFFF,$B6B6B6);
BtnSetEnabledBotvaU(uCancelUninstBtn,False);
end;
ImgApplyChanges(u);
end;
end;
////////////////////// UninstallingPage //////////////////////
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep=usUninstall then begin
u:=UninstallProgressForm.Handle;
UninstallProgressForm.ProgressBar.Hide;
ImgLoadBotvaU(u,ExpandConstant('{tmp}\WizardImage.jpg'),0,0,UninstallProgressForm.Width,UninstallProgressForm.Height,True,True);
UninstPB:=ImgPBCreateUn(u, ExpandConstant('{tmp}\pbbkg.png'),ExpandConstant('{tmp}\pb.png'),UninstallProgressForm.ProgressBar.Left,100,UninstallProgressForm.ProgressBar.Width,25);
ImgApplyChanges(u);
UFCaption:=UninstallProgressForm.Caption;
// UninstPBOldProc:=SetWindowLong(UninstallProgressForm.ProgressBar.Handle,-4,CallBackProc(@UninstPBProc,4));
end;
end;
procedure DeinitializeUninstall;
begin
UnloadSkinUninst;
gdipShutdownBotvaU;
end;