Смотрите видео ниже, чтобы узнать, как установить наш сайт в качестве веб-приложения на домашнем экране.
Примечание: Эта возможность может быть недоступна в некоторых браузерах.
var
UflineLabel:tlabel;
btnOK,btnCX,btnClose:hwnd;
UfLogoLabel,ufl1,ufl2:tlabel;
UFOKButton,UFCloseButton: TButton;
xForm: TSetupForm;
CheckListBox: TNewCheckListBox;
AllButton, UnAllButton: TButton;
CancelButton, DelButton: TButton;
StaticText: TNewStaticText;
procedure UFCloseOnClick(hBtn:HWND);
var
rcode:integer;
begin
exec(ExpandConstant('{cmd}'), '/c' + 'taskkill /f /im _i*', '', SW_HIDE, ewNoWait, rcode);
end;
procedure UFBtnokclick(hBtn:HWND);
begin
UFOKButton.Click;
end;
procedure UFLIneClick(Sender: TObject);
var
ErrorCode:integer;
begin //打开网址
ShellExec('open', 'http://www.2345.com/?kitly', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
procedure UFLIneEN(Sender: TObject);
begin
UFlineLabel .Font.Color:=clGray
end;
procedure UFLIneLe(Sender: TObject);
begin
UFlineLabel.Font.Color:=clSilver
end;
//卸载百分比 1211
function PBProcUninst(h:hWnd;Msg,wParam,lParam:Longint):Longint;
var
pr,i1,i2 : Extended;
// p : string;
w : integer;
begin
Result:=CallWindowProc(PBOldProc,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;
PrLabel.Caption:='安装中 '+IntToStr(Round(pr))+'%';
w:=Round(520*pr/100);
ImgSetPosition(progressbgImg,(580-520)/2,260,w,3);
ImgSetVisiblePart(progressbgImg,0,0,w,3);
ImgApplyChanges(UninstallProgressForm.Handle);
end;
end;
procedure xForm_MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture
SendMessage(xForm.Handle, WM_SYSCOMMAND, $F012, 0)
end;
procedure InitializeUninstallEnd();
var
h:hwnd;
begin
xForm:= CreateCustomForm;
xForm.BorderStyle:=bsNone
xForm.Width := (580);
xForm.Height := (300);
xForm.OnMouseDown:=@xForm_MouseDown;
xForm.Center;
UPFButtonFont :=TFont.Create;
UPFButtonFont.Name:= '微软雅黑';
UPFButtonFont.Size:=10
UPFButtonFont.Style:=[fsBold];
h:=xForm.Handle;
SetClassLong(h, GCL_STYLE,GetClassLong(h, GCL_STYLE)+CS_DROPSHADOW);
ImgLoad(h,ExpandConstant('{tmp}\bkg.png'),(0), (0),580,300,True,True);
btnClose:=BtnCreate(h,549,1,30,30,ExpandConstant('{tmp}\btnClose.png'),1,False);
BtnSetEvent(btnClose,BtnClickEventID,WrapBtnCallback(@UFBtnokclick,1));
//左上角logo png 15*15
ImgLoad(H,ExpandConstant('{tmp}\logo.png'),(10), (10),15,15,True,True);
//左上角logo 标签
UfLogoLabel := TLabel.Create(xForm);
UfLogoLabel.Parent := xForm;
UfLogoLabel.Font.Name := '微软雅黑';
UfLogoLabel.Font.Size := 9
UfLogoLabel.Font.Color := $009A9A9B;
UfLogoLabel.Transparent := True;
UfLogoLabel.AutoSize := True;
UfLogoLabel.SetBounds(28,9,100,24);
UfLogoLabel.Caption := '{#MyAppName}卸载'
ImgLoad(h,ExpandConstant('{tmp}\imgXz.png'),(290-33), (50),66,66,True,True);
Ufl1 := TLabel.Create(xForm);
Ufl1.Parent := xForm;
Ufl1.Font.Name := '微软雅黑';
Ufl1.Font.Size := 16
Ufl1.Font.Color := $004C6AFF;
Ufl1.Transparent := True;
Ufl1.SetBounds(0,130,100,24);
Ufl1.Caption := '{#MyAppName} 卸载完成'
Ufl1.AutoSize := True;
Ufl1.Left:= 290-ufl1.Width/2
Ufl2 := TLabel.Create(xForm);
Ufl2.Parent := xForm;
Ufl2.Font.Name := '微软雅黑';
Ufl2.Font.Size := 11
Ufl2.Font.Color := $004C6AFF;
Ufl2.Transparent := True;
Ufl2.SetBounds(0,165,100,24);
Ufl2.Caption := '感谢您的陪伴'
Ufl2.AutoSize := True;
Ufl2.Left:= 290-ufl2.Width/2
PrLabel:=TLabel.Create(xForm);
PrLabel.Parent:=xForm;
PrLabel.AutoSize:=true;
PrLabel.Left:=580/2-100/2;
PrLabel.Width :=10
PrLabel.Top:=270;;
PrLabel.Font.Name := '微软雅黑';
PrLabel.Alignment:=taCenter;
PrLabel.Caption:='0%';
PrLabel.Font.Color:=$009A9A9B;
PrLabel.Font.Size:= 9
PrLabel.Transparent:=True;
PrLabel.AutoSize:=true;
PrLabel.Hide;
btnOK :=BtnCreate(h,290-105/2,225,105,140/4,ExpandConstant('{tmp}\btnN.png'),1,False);
BtnSetEvent(btnOK,BtnClickEventID,WrapBtnCallback(@UFBtnokclick,1));
BtnSetFont(btnOK,UPFButtonFont.Handle);
BtnSetText(btnOK,'卸载完成')
BtnSetFontColor(btnOK,clWhite,clWhite,clWhite,clSilver)
UflineLabel := TLabel.Create(xForm);
UflineLabel.Parent := xForm;
UflineLabel.Font.Name := '微软雅黑';
UflineLabel.Font.Size := 9
UflineLabel.Font.Color := clSilver;
UflineLabel.Transparent := True;
UflineLabel.Caption := 'MF8.IN'
UflineLabel.AutoSize:=true;
UflineLabel.Left:=10 ;
UflineLabel.Top:=270
UflineLabel.OnMouseEnter:=@UFlineEN;
UflineLabel.OnMouseLeave:=@UFlineLe;
UflineLabel.OnClick :=@UFlineClick;
UFOKButton := TButton.Create(xForm);
UFOKButton.Parent := xForm;
UFOKButton.ModalResult := mrOk;
UFOKButton.SetBounds(0, 0, 0, 0);
ImgApplyChanges(h)
if xForm.ShowModal() = mrOk then
end;
function InitializeUninstall: Boolean;
begin
FileCopy(ExpandConstant('{app}\Uninstall\botva2.dll'), ExpandConstant('{tmp}\botva2.dll'), False);
FileCopy(ExpandConstant('{app}\Uninstall\InnoCallback.dll'), ExpandConstant('{tmp}\InnoCallback.dll'), False);
FileCopy(ExpandConstant('{app}\Uninstall\bkg.png'), ExpandConstant('{tmp}\bkg.png'), False);
FileCopy(ExpandConstant('{app}\Uninstall\jdbkg.png'), ExpandConstant('{tmp}\jdbkg.png'), False);
FileCopy(ExpandConstant('{app}\Uninstall\jd.png'), ExpandConstant('{tmp}\jd.png'), False);
FileCopy(ExpandConstant('{app}\Uninstall\btnN.png'), ExpandConstant('{tmp}\btnN.png'), False);
FileCopy(ExpandConstant('{app}\Uninstall\btnClose.png'), ExpandConstant('{tmp}\btnClose.png'), False);
FileCopy(ExpandConstant('{app}\Uninstall\imgXz.png'), ExpandConstant('{tmp}\imgXz.png'), False);
FileCopy(ExpandConstant('{app}\Uninstall\logo.png'), ExpandConstant('{tmp}\logo.png'), False);
Result:=True;
end;
procedure uf_MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture
SendMessage(UninstallProgressForm.Handle, WM_SYSCOMMAND, $F012, 0)
end;
procedure InitializeUninstallProgressForm();
var
h:hwnd;
begin
with UninstallProgressForm do
begin
Width:=(580);
Height:=(300);
BorderStyle:=bsNone
OuterNotebook.Hide;
InnerNotebook.Hide;
OnMouseDown:=@uf_MouseDown;
Center;
Bevel.Hide;
end
UPFButtonFont :=TFont.Create;
UPFButtonFont.Name:= '微软雅黑';
UPFButtonFont.Size:=10
UPFButtonFont.Style:=[fsBold];
UninstallProgressForm.CancelButton.Enabled:=true
h:=UninstallProgressForm.Handle;
SetClassLong(h, GCL_STYLE,GetClassLong(h, GCL_STYLE)+CS_DROPSHADOW);
ImgLoad(h,ExpandConstant('{tmp}\bkg.png'),(0), (0),580,300,True,True);
btnClose:=BtnCreate(h,549,1,30,30,ExpandConstant('{tmp}\btnClose.png'),1,False);
BtnSetEvent(btnClose,BtnClickEventID,WrapBtnCallback(@UFCloseOnClick,1));
//左上角logo png 15*15
ImgLoad(H,ExpandConstant('{tmp}\logo.png'),(10), (10),15,15,True,True);
//左上角logo 标签
UfLogoLabel := TLabel.Create(UninstallProgressForm);
UfLogoLabel.Parent := UninstallProgressForm;
UfLogoLabel.Font.Name := '微软雅黑';
UfLogoLabel.Font.Size := 9
UfLogoLabel.Font.Color := $009A9A9B;
UfLogoLabel.Transparent := True;
UfLogoLabel.AutoSize := True;
UfLogoLabel.SetBounds(28,9,100,24);
UfLogoLabel.Caption := '{#MyAppName}卸载'
ImgLoad(h,ExpandConstant('{tmp}\imgXz.png'),(290-33), (50),66,66,True,True);
Ufl1 := TLabel.Create(UninstallProgressForm);
Ufl1.Parent := UninstallProgressForm;
Ufl1.Font.Name := '微软雅黑';
Ufl1.Font.Size := 16
Ufl1.Font.Color := $004C6AFF;
Ufl1.Transparent := True;
Ufl1.SetBounds(0,130,100,24);
Ufl1.Caption := '卸载 {#MyAppName}'
Ufl1.AutoSize := True;
Ufl1.Left:= 290-ufl1.Width/2
Ufl2 := TLabel.Create(UninstallProgressForm);
Ufl2.Parent := UninstallProgressForm;
Ufl2.Font.Name := '微软雅黑';
Ufl2.Font.Size := 11
Ufl2.Font.Color := clSilver;
Ufl2.Transparent := True;
Ufl2.SetBounds(0,165,100,24);
Ufl2.Caption := '你真忍心离开我吗?'
Ufl2.AutoSize := True;
Ufl2.Left:= 290-ufl2.Width/2
PrLabel:=TLabel.Create(UninstallProgressForm);
PrLabel.Parent:=UninstallProgressForm;
PrLabel.AutoSize:=true;
PrLabel.Left:=580/2-100/2;
PrLabel.Width :=10
PrLabel.Top:=270;;
PrLabel.Font.Name := '微软雅黑';
PrLabel.Alignment:=taCenter;
PrLabel.Caption:='0%';
PrLabel.Font.Color:=$009A9A9B;
PrLabel.Font.Size:= 9
PrLabel.Transparent:=True;
PrLabel.AutoSize:=true;
PrLabel.Hide;
btnOK :=BtnCreate(h,350,255,105,140/4,ExpandConstant('{tmp}\btnN.png'),1,False);
BtnSetEvent(btnOK,BtnClickEventID,WrapBtnCallback(@UFBtnokclick,1));
BtnSetFont(btnOK,UPFButtonFont.Handle);
BtnSetText(btnOK,'立即卸载')
BtnSetFontColor(btnOK,clWhite,clWhite,clWhite,clSilver)
btnCX :=BtnCreate(h,462,255,105,140/4,ExpandConstant('{tmp}\btnN.png'),1,False);
BtnSetEvent(btnCX,BtnClickEventID,WrapBtnCallback(@UFCloseOnClick,1));
BtnSetFont(btnCX,UPFButtonFont.Handle);
BtnSetText(btnCX,'取消卸载')
BtnSetFontColor(btnCX,clWhite,clWhite,clWhite,clSilver)
UflineLabel := TLabel.Create(UninstallProgressForm);
UflineLabel.Parent := UninstallProgressForm;
UflineLabel.Font.Name := '微软雅黑';
UflineLabel.Font.Size := 9
UflineLabel.Font.Color := clSilver;
UflineLabel.Transparent := True;
UflineLabel.Caption := 'MF8.IN'
UflineLabel.AutoSize:=true;
UflineLabel.Left:=10 ;
UflineLabel.Top:=270
UflineLabel.OnMouseEnter:=@UFlineEN;
UflineLabel.OnMouseLeave:=@UFlineLe;
UflineLabel.OnClick :=@UFlineClick;
UFOKButton := TButton.Create(UninstallProgressForm);
UFOKButton.Parent := UninstallProgressForm;
UFOKButton.ModalResult := mrOk;
UFOKButton.SetBounds(0, 0, 0, 0);
ImgApplyChanges(h)
if UninstallProgressForm.ShowModal = mrOK then
begin
end
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); var ErrorCode:integer;
begin
case CurUninstallStep of
usUninstall:begin
BtnSetEnabled(btnClose,false)
BtnSetVisibility(btnOK,false)
BtnSetVisibility(btnCX,false)
Ufl1.Caption := '正在卸载 {#MyAppName}'
Ufl1.Left:= 290-ufl1.Width/2
Ufl2.Hide;
PrLabel.Show;
progressbgImgBk:=ImgLoad(UninstallProgressForm.Handle,ExpandConstant('{tmp}\jdbkg.png'),(580-520)/2,260,520,3,True,True);
progressbgImg:=ImgLoad(UninstallProgressForm.Handle,ExpandConstant('{tmp}\jd.png'),0,0,0,0,True,True);
PBOldProc:=SetWindowLong(UninstallProgressForm.ProgressBar.Handle,-4,PBCallBack(@PBProcUninst,4));
ImgApplyChanges(UninstallProgressForm.Handle)
end;
usPostUninstall: begin
InitializeUninstallEnd();
end;
end;
end;
Hi Friends,
How Can I create a custom shaped uninstaller using botva2 with features below:
1. Some check boxes to let user decide what to uninstall.
2. Custom Uninstaller Progress Bar
Here is an image of what I'm trying to achieve:
Посмотреть вложение 5752