Смотрите видео ниже, чтобы узнать, как установить наш сайт в качестве веб-приложения на домашнем экране.
Примечание: Эта возможность может быть недоступна в некоторых браузерах.
var
SettingPanel: TPanel;
hBtn: TButton;
//iStartTime: Integer; //debug
iTimer, iRollInfo: Integer;
function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): LongWord; external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord; external 'KillTimer@user32.dll stdcall';
//function GetTickCount: DWORD; external 'GetTickCount@kernel32.dll stdcall'; //debug
procedure TimerProc(hwnd: HWND; uMsg: UINT; idEvent: UINT_PTR; dwTime: DWORD);
var
iLen, iStep: Integer;
begin
iLen := iRollInfo and $FFFF;
iStep := (iRollInfo and $FF0000) shr $10;
case iRollInfo shr $18 of
$0: begin
if SettingPanel.Left >= -iStep then
begin
KillTimer(0, iTimer);
hBtn.Enabled := True;
end;
SettingPanel.Left := SettingPanel.Left + iStep;
//WizardForm.Caption := 'time: ' + IntToStr(dwTime-iStartTime) + '; length: ' + IntToStr(SettingPanel.Left); //debug
end;
$1: begin
if SettingPanel.Left <= -iLen + iStep then
begin
KillTimer(0, iTimer);
hBtn.Enabled := True;
end;
SettingPanel.Left := SettingPanel.Left - iStep;
//WizardForm.Caption := 'time: ' + IntToStr(dwTime-iStartTime) + '; length: ' + IntToStr(SettingPanel.Left); //debug
end;
$2: begin
if SettingPanel.Top >= -iStep then
begin
KillTimer(0, iTimer);
hBtn.Enabled := True;
end;
SettingPanel.Top := SettingPanel.Top + iStep;
//WizardForm.Caption := 'time: ' + IntToStr(dwTime-iStartTime) + '; length: ' + IntToStr(SettingPanel.Top); //debug
end;
$3: begin
if SettingPanel.Top <= -iLen + iStep then
begin
KillTimer(0, iTimer);
hBtn.Enabled := True;
end;
SettingPanel.Top := SettingPanel.Top - iStep;
//WizardForm.Caption := 'time: ' + IntToStr(dwTime-iStartTime) + '; length: ' + IntToStr(SettingPanel.Top); //debug
end;
end;
end;
procedure RollControl(Ctrl: TControl; dwTime, dwFlag: DWORD);
// Ctrl : control
// dwTime : rolling time, ms
// dwFlag : roll type ($0 - left to right, $1 - right to left, $2 - top to bottom, $3 - bottom to top)
var
iLen, iStep: Integer;
iKoeff: Extended;
begin
iLen := (dwFlag shr $1 xor $1)*Ctrl.Width + (dwFlag shr $1)*Ctrl.Height;
repeat
iStep := iStep + 1;
iKoeff := (iStep * dwTime)/(iLen * 1000/64);
until iKoeff >= 1;
//
if iRollInfo = 0 then iRollInfo := (dwFlag shl $18) or (iStep shl $10) or iLen else iRollInfo := iRollInfo xor $1000000;
iTimer := SetTimer(0, 0, Trunc(iKoeff)*1000/64, CallbackAddr('TimerProc'));
end;
procedure HideShow(Sender: TObject);
begin
//iStartTime := GetTickCount; //debug
RollControl(SettingPanel, 1000, $2);
TButton(Sender).Enabled := False;
end;
procedure InitializeWizard();
begin
SettingPanel := TPanel.Create(WizardForm);
with SettingPanel do
begin
Parent := WizardForm;
SetBounds(ScaleX(0), ScaleY(-315), ScaleX(497), ScaleY(315));
ParentBackground := False;
end;
hBtn := TButton.Create(WizardForm);
with hBtn do
begin
OnClick := @HideShow;
SetBounds(ScaleX(40), ScaleY(327), ScaleX(75), ScaleY(25));
Caption := 'Show';
Parent := WizardForm;
end;
end;
[/SPOILER]
[SPOILER=2 пример]
[Setup]
AppName=My Program
AppVerName=My Program v 1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
OutputDir=.
[Code]
var
SettingPanel : TPanel;
Flag : boolean;
Timer : LongWord;
function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): LongWord; external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord; external 'KillTimer@user32.dll stdcall';
procedure MyTimer;
begin
case Flag of
True :
begin
if SettingPanel.Top = 0 then
KillTimer(WizardForm.Handle, Timer);
if SettingPanel.Top < 0 then SettingPanel.Top := SettingPanel.Top + ScaleY(3);
end;
False :
begin
if SettingPanel.Top = ScaleY(-315) then
KillTimer(WizardForm.Handle, Timer);
if SettingPanel.Top > ScaleY(-315) then SettingPanel.Top := SettingPanel.Top - ScaleY(3);
end;
end;
end;
procedure HideShow(Sender: TObject);
begin
KillTimer(WizardForm.Handle, Timer);
Timer := SetTimer(WizardForm.Handle, 1, 5 , CallbackAddr('MyTimer'));
case Flag of
True : TButton(Sender).Caption:='Show';
False : TButton(Sender).Caption:='Hide';
end;
Flag:= not Flag;
end;
procedure InitializeWizard();
begin
Flag:= False;
SettingPanel := TPanel.Create(WizardForm);
with SettingPanel do
begin
Parent := WizardForm;
SetBounds(ScaleX(0),ScaleY(-315),ScaleX(497),ScaleY(313));
ParentBackground := False;
end;
with TButton.Create(WizardForm) do
begin
OnClick:= @HideShow;
SetBounds(ScaleX(40),ScaleY(327),ScaleX(75),ScaleY(25))
Caption:='Show';
Parent:= WizardForm;
end;
end;
[/SPOILER]
[SPOILER=3 пример]
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application
[code]
const
GWL_EXSTYLE = (-20);
WS_EX_COMPOSITED = $2000000;
AW_HIDE = $10000;
AW_VER_POSITIVE = $4;
AW_VER_NEGATIVE = $8;
function SetWindowLong(Wnd: HWnd; Index: Integer; NewLong: Longint): Longint; external 'SetWindowLongA@user32.dll stdcall';
function GetWindowLong(Wnd: HWnd; Index: Integer): Longint; external 'GetWindowLongA@user32.dll stdcall';
function AnimateWindow(hwnd: HWND; dwTime, dwFlags: DWORD): BOOL; external 'AnimateWindow@user32.dll stdcall';
var
SettingPanel: TPanel;
procedure NewButton1Click(Sender: TObject);
begin
with SettingPanel do
begin
//временно отрубаем стиль WS_EX_COMPOSITED, а то AnimateWindow плавненько не отработает
SetWindowLong(WizardForm.Handle, GWL_EXSTYLE, GetWindowLong(WizardForm.Handle, GWL_EXSTYLE) xor WS_EX_COMPOSITED);
AnimateWindow(Handle, 1000, (AW_VER_POSITIVE * dword(not Visible)) or ((AW_HIDE or AW_VER_NEGATIVE) * dword(Visible)));
SetWindowLong(WizardForm.Handle, GWL_EXSTYLE, GetWindowLong(WizardForm.Handle, GWL_EXSTYLE) or WS_EX_COMPOSITED);
Visible := not Visible;
end;
end;
procedure InitializeWizard();
begin
SetWindowLong(WizardForm.Handle, GWL_EXSTYLE, GetWindowLong(WizardForm.Handle, GWL_EXSTYLE) or WS_EX_COMPOSITED);
SettingPanel := TPanel.Create(WizardForm);
with SettingPanel do
begin
Parent := WizardForm;
SetBounds(ScaleX(0), ScaleY(0), WizardForm.ClientWidth, WizardForm.OuterNotebook.ClientHeight);
Visible := False;
end;
with TNewButton.Create(WizardForm) do
begin
Parent := WizardForm;
SetBounds(ScaleX(40), ScaleY(327), ScaleX(75), ScaleY(25));
Caption := 'open';
OnClick := @NewButton1Click;
end;
end;
[/SPOILER]
не отображается надписи
[CustomMessages]
text=Надпись
[color=none][[/color]Code]
Test.Caption:=ExpandConstant('{cm:text}');
Код:[Custom Messages] text=Надпись [color=none][[/color]Code] Test.Caption:=ExpandConstant('{cm:text}');
Этот код я знаю но в моем скрипте он не канает там все подругому идет
WizardForm.Position:=poScreenCenter;
TestCheckListBox := TNewCheckListBox.Create(WizardForm);
with TestCheckListBox do begin
Parent := WizardForm.SelectDirPage;
BorderStyle := bsNone;
Color := WizardForm.SelectDirPage.Color;
WantTabs := True;
SetBounds(WizardForm.DiskSpaceLabel.Left, WizardForm.DirEdit.Top + ScaleY(30), ScaleX(300), Height);
OnClickCheck := @TestClickCheck;
AddRadioButton('{cm:Cracked}', '', 0, True, True, nil);
AddRadioButton('{cm:License}', '', 0, False, True, nil);
WizardForm.DirBrowseButton.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.WizardSmallBitmapImage.Left := ScaleX(0);
WizardForm.WizardSmallBitmapImage.Top := ScaleY(0);
WizardForm.WizardSmallBitmapImage.Width := WizardForm.MainPanel.Width;
WizardForm.WizardSmallBitmapImage.Height := WizardForm.MainPanel.Height;
with TButton.Create(nil) do
нужно мне вместо нх вставить текст из [Messages]
function ReleaseCapture(): Longint; external 'ReleaseCapture@user32.dll stdcall';
procedure LabelOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
SendMessage(WizardForm.Handle,$0112,$F012,0)
end;
....
with TLabel.Create(WizardForm) do begin
Parent:=WizardForm;
AutoSize:=False;
SetBounds(ScaleX(70), ScaleY(7), ScaleX(370), ScaleY(16));
Font.Name:= 'Georgia';
Font.Size:= 9;
Transparent:=True;
Font.Color:=$FFFFFF;
Font.Style:=[fsBold, fsItalic];
OnMouseDown:=@LabelOnMouseDown;
Caption:=WizardForm.Caption; // Если не нужен текст убери строчку
end;
procedure LabelOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
SendMessage(WizardForm.Handle,$0112,$F012,0)
end;
procedure LabelOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
SendMessage(MyExit.Handle,$0112,$F012,0)
end;
var
ResizeButton: TButton;
PageResized: Boolean;
function GetSystemMetrics(nIndex:Integer):integer; external 'GetSystemMetrics@user32.dll stdcall delayload';
procedure MinimizeInstallPage();
begin
WizardForm.MainPanel.Visible:=False;
WizardForm.Bevel1.Visible:=False;
WizardForm.Width:=ScaleX(395);
WizardForm.Height:=ScaleY(142);
WizardForm.Left:=GetSystemMetrics(16)-ScaleX(420);
WizardForm.Top:=GetSystemMetrics(17)-ScaleX(150);
WizardForm.InnerNotebook.Left:=ScaleX(10);
WizardForm.InnerNotebook.Top:=ScaleY(10);
WizardForm.InnerNotebook.Width:=ScaleX(370);
WizardForm.StatusLabel.Left:=ScaleX(0);
WizardForm.StatusLabel.Top:=ScaleY(0);
WizardForm.StatusLabel.Width:=WizardForm.InnerNotebook.Width;
WizardForm.FileNameLabel.Left:=ScaleX(0);
WizardForm.FileNameLabel.Top:=ScaleY(20);
WizardForm.FileNameLabel.Width:=WizardForm.InnerNotebook.Width;
WizardForm.ProgressGauge.Top:=ScaleY(40);
WizardForm.ProgressGauge.Width:=WizardForm.InnerNotebook.Width;
WizardForm.CancelButton.Left:=ScaleX(220);
WizardForm.CancelButton.Top:=ScaleY(80);
WizardForm.CancelButton.BringToFront;
ResizeButton.Left:= ScaleX(60);
ResizeButton.Top:= ScaleY(80)
ResizeButton.Caption:= 'Normalize';
PageResized:= True
end;
procedure ResumeInstallPage();
begin
WizardForm.Width:= ScaleX(503);
WizardForm.Height:= ScaleY(388);
WizardForm.Position:= poScreenCenter;
WizardForm.MainPanel.SetBounds(ScaleX(0), ScaleY(0), ScaleX(497), ScaleY(58));
WizardForm.MainPanel.Show;
WizardForm.Bevel1.Show;
WizardForm.InnerNotebook.SetBounds(ScaleX(40), ScaleY(72), ScaleX(417), ScaleY(237));
WizardForm.StatusLabel.SetBounds(ScaleX(0), ScaleY(0), ScaleX(417), ScaleY(16));
WizardForm.FilenameLabel.SetBounds(ScaleX(0), ScaleY(16), ScaleX(417), ScaleY(16));
WizardForm.ProgressGauge.SetBounds(ScaleX(0), ScaleY(42), ScaleX(417), ScaleY(21));
WizardForm.CancelButton.SetBounds(ScaleX(412), ScaleY(327), ScaleX(75), ScaleY(23));
ResizeButton.SetBounds(ScaleX(20), ScaleY(327),ScaleX(75), ScaleY(23));
ResizeButton.Caption:= 'Minimize';
PageResized:= False;
end;
procedure ResizeButtonOnClick(Sender: TObject);
begin
If PageResized then
ResumeInstallPage
else
MinimizeInstallPage;
end;
procedure InitializeWizard();
begin
ResizeButton:= TButton.Create(WizardForm);
ResizeButton.SetBounds(ScaleX(20), ScaleY(327),ScaleX(75), ScaleY(23));
ResizeButton.OnClick:= @ResizeButtonOnClick
ResizeButton.Caption:= 'Minimize';
ResizeButton.Hide;
ResizeButton.Parent:= WizardForm;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpInstalling then ResizeButton.Show;
end;[/SPOILER]