In the above attached WinTB example, have the line DisableReadyPage=yes in Setup section.When i disable this line(To enable ready page) installer popup the Cannot focus a disabled or invisible window. error message.Это нужно когда окно без заголовка. Или например на форме слайды и нужно на миниатюре отобразить только область со слайдамиКод:SetTaskBarThumbnailClip(0, 0, WizardForm.WizardBitmapImage.Height, WizardForm.WizardBitmapImage.Width);
#ifndef UNICODE
#pragma error 'Inno Setup (u) is required to compile this script'
#endif
#define MyAppName "WinTB"
#define MyAppVersion "1.0"
#define MyAppExeName "MyProg.exe"
[setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputDir=.
DisableWelcomePage=no
DisableReadyPage=yes
[files]
Source: "tb.dll"; Flags: dontcopy nocompression;
[Types]
Name: "custom"; Description: "Custom installation"; Flags: iscustom
[Components]
Name: Icons; Description:Additional icons:; Types: custom; Flags: fixed
Name: Icons\CreateDesktopIcon; Description:Create a shortcut on the desktop; Types: custom;
Name: Icons\StartMenuIcon; Description:Create a shortcuts in the Start Menu; Types: custom;
#ifdef Components
Name: Lang; Description: Localization language:; Types: custom; Flags: fixed
Name: Lang/rus; Description: Russian; Flags: exclusive;
Name: Lang/eng; Description: English; Flags: exclusive;
#endif
Name: Redist; Description:Additional Software:; Types: custom; Flags: fixed
Name: Redist\Redist1; Description:Install\Update Microsoft DirectX (òðåáóåòüñÿ ñîåäèíåíèå ñ èíòåðíåòîì); Types: custom;
Name: Redist\Redist2; Description:Install\Update Microsoft Visual C++ Redist; Types: custom;
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Components: Icons\StartMenuIcon
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Components: Icons\CreateDesktopIcon
[code]
const
TBPF_NOPROGRESS = 0;
TBPF_INDETERMINATE = 1;
TBPF_NORMAL = 2;
TBPF_ERROR = 4;
TBPF_PAUSED = 8;
MF_BYCOMMAND = 0;
MF_ENABLED = 0;
MF_GRAYED = 1;
MF_DISABLED = 2;
SC_CLOSE = 61536;
type
PWideChar = String;
procedure SetTaskBarThumbnailClip(left, top, bottom, right: integer); external 'SetTaskBarThumbnailClip@{tmp}\tb.dll stdcall delayload';
procedure SetTaskBarProgressValue(value: integer); external 'SetTaskBarProgressValue@{tmp}\tb.dll stdcall delayload';
procedure SetTaskBarProgressState(value: integer); external 'SetTaskBarProgressState@{tmp}\tb.dll stdcall delayload';
procedure SetTaskBarTitle(const caption: pwidechar); external 'SetTaskBarTitle@{tmp}\tb.dll stdcall delayload';
procedure SetTaskBarThumbnailTooltip(const caption: pwidechar); external 'SetTaskBarThumbnailTooltip@{tmp}\tb.dll stdcall delayload';
function GetForegroundWindow: HWND; external 'GetForegroundWindow@user32.dll stdcall delayload';
function SetForegroundWindow(hWnd: HWND): BOOL; external 'SetForegroundWindow@user32.dll stdcall delayload';
function GetSystemMenu(hWnd: HWND; bRevert: BOOL): LongWord; external 'GetSystemMenu@user32.dll stdcall';
function EnableMenuItem(hMenu: THandle; uIDEnableItem: Longword; uEnable: Longword): Boolean; external 'EnableMenuItem@user32.dll stdcall';
procedure MShow(Sender: TObject);
begin
MainForm.Show;
if GetForegroundWindow = WizardForm.Handle then
SetForegroundWindow(MainForm.Handle);
end;
procedure DirOnClick(Sender: TObject);
var
UserSelectDir: String;
begin
UserSelectDir:= WizardForm.DirEdit.Text;
if BrowseForFolder(SetupMessage(msgBrowseDialogLabel), UserSelectDir, True) then
WizardForm.DirEdit.Text:= UserSelectDir;
end;
procedure InitializeWizard();
var
r: TRect;
begin
ExtractTemporaryFile('tb.dll');
SetTaskBarProgressState(TBPF_PAUSED);
SetTaskBarProgressValue(10);
SetTaskBarThumbnailTooltip('WinTB - Setup');
SetTaskBarTitle('WinTB');
//SetTaskBarThumbnailClip(0, 0, WizardForm.WizardBitmapImage.Height+26, WizardForm.WizardBitmapImage.Width+500);
SetTaskBarThumbnailClip(0, 0, WizardForm.Height, WizardForm.Width);
with MainForm do begin
Width := WizardForm.Width;
Height := WizardForm.Height;
BorderIcons := WizardForm.BorderIcons;
BorderStyle := WizardForm.BorderStyle;
Position:= poScreenCenter;
with TBitmapImage.Create(MainForm) do begin
Parent := MainForm;
Width := MainForm.ClientWidth;
Height := MainForm.ClientHeight;
with Bitmap do begin
Width := Width;
Height := Height;
Canvas.Brush.Color := clWindow;
r.Left := 0;
r.Top := 0;
r.Right := WizardfOrm.ClientWidth;
r.Bottom := WizardForm.ClientHeight;
Canvas.FillRect(r);
end;
end;
end;
with WizardForm do begin
Left:= -10000;
OnShow:= @MShow;
NextButton.Parent:= MainForm;
BackButton.Parent:= MainForm;
CancelButton.Parent:= MainForm;
OuterNotebook.Parent:= MainForm;
Bevel.Parent:= MainForm;
DirBrowseButton.OnClick:= @DirOnClick;
end;
with WizardForm.ComponentsList do
begin
Parent:=WizardForm.SelectDirPage;
SetBounds(ScaleX(220),ScaleY(155),ScaleX(200),ScaleY(80));
WantTabs:=True;
Color:= WizardForm.Color;
BorderStyle:=bsSingle//
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID=wpSelectDir then
WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall);
if CurPageID=wpFinished then
EnableMenuItem(GetSystemMenu(MainForm.Handle, false), SC_CLOSE, MF_DISABLED or MF_BYCOMMAND);
end;
[setup]
AppName=Test
AppVersion=0.1
DefaultDirName={sd}\Test
DisableWelcomePage=no
[Files]
Source: "TB.dll"; Flags: dontcopy nocompression;
[Types]
Name: "custom"; Description: "Custom installation"; Flags: iscustom
[Components]
Name: Icons; Description:Additional icons:; Types: custom; Flags: fixed
Name: Icons\CreateDesktopIcon; Description:Create a shortcut on the desktop; Types: custom;
Name: Icons\StartMenuIcon; Description:Create a shortcuts in the Start Menu; Types: custom;
#ifdef Components
Name: Lang; Description: Localization language:; Types: custom; Flags: fixed
Name: Lang/rus; Description: Russian; Flags: exclusive;
Name: Lang/eng; Description: English; Flags: exclusive;
#endif
Name: Redist; Description:Additional Software:; Types: custom; Flags: fixed
Name: Redist\Redist1; Description:Install\Update Microsoft DirectX; Types: custom;
Name: Redist\Redist2; Description:Install\Update Microsoft Visual C++ Redist; Types: custom;
[Code]
// Tb.dll
const
TBPF_NOPROGRESS = 0;
TBPF_INDETERMINATE = 1;
TBPF_NORMAL = 2;
TBPF_ERROR = 4;
TBPF_PAUSED = 8;
procedure SetTaskBarThumbnailClip(Left, Top, Bottom, Right: Integer); external 'SetTaskBarThumbnailClip@files:tb.dll stdcall delayload';
procedure SetTaskBarProgressValue(Value: Integer); external 'SetTaskBarProgressValue@files:tb.dll stdcall delayload';
procedure SetTaskBarProgressState(Value: Integer); external 'SetTaskBarProgressState@files:tb.dll stdcall delayload';
procedure SetTaskBarTitle(const Caption: String); external 'SetTaskBarTitle@files:tb.dll stdcall delayload';
procedure SetTaskBarThumbnailTooltip(const Caption: String); external 'SetTaskBarThumbnailTooltip@files:tb.dll stdcall delayload';
// WinApi
function GetSystemMetrics(nIndex: Integer): Integer; external 'GetSystemMetrics@user32.dll stdcall';
// Code
var
DblNextButton: TButton;
procedure MShow(Sender: TObject);
begin
if not MainForm.Showing then MainForm.Show;
PostMessage(MainForm.Handle, $7, 0, 0); //WM_SETFOCUS
end;
procedure DirOnClick(Sender: TObject);
var
UserSelectDir: String;
begin
UserSelectDir:=WizardForm.DirEdit.Text;
if BrowseForFolder(SetupMessage(msgBrowseDialogLabel), UserSelectDir, True) then WizardForm.DirEdit.Text:=UserSelectDir;
end;
procedure DblNextEvent(Sender: TObject);
begin
WizardForm.NextButton.OnClick(WizardForm.NextButton);
end;
procedure InitializeWizard;
var
r: TRect;
begin
SetTaskBarProgressValue(50);
SetTaskBarProgressState(TBPF_ERROR);
SetTaskBarTitle('{#SetupSetting("AppName")}');
SetTaskBarThumbnailTooltip('{#SetupSetting("AppName")}');
SetTaskBarThumbnailClip(0, 0, WizardForm.Height-26, WizardForm.Width);
//
with MainForm do begin
SetBounds(ScaleX(Round((GetSystemMetrics(0)-WizardForm.Width) div 2)), ScaleY(Round((GetSystemMetrics(1)-WizardForm.Height) div 2)),
ScaleX(WizardForm.Width), ScaleY(WizardForm.Height));
BorderIcons:=WizardForm.BorderIcons;
BorderStyle:=WizardForm.BorderStyle;
//Position:=poScreenCenter;
with TBitmapImage.Create(MainForm) do begin
Parent:=MainForm;
Width:=MainForm.ClientWidth;
Height:=MainForm.ClientHeight;
with Bitmap do begin
Width:=Width;
Height:=Height;
Canvas.Brush.Color:=clWindow;
r.Right:=WizardForm.ClientWidth;
r.Bottom:=WizardForm.ClientHeight;
Canvas.FillRect(r);
end;
end;
end;
with WizardForm do begin
BackButton.Parent:=MainForm;
CancelButton.Parent:=MainForm;
OuterNotebook.Parent:=MainForm;
Bevel.Parent:=MainForm;
DirBrowseButton.OnClick:=@DirOnClick;
OnShow:=@MShow;
end;
DblNextButton:=TButton.Create(nil);
with DblNextButton do begin
SetBounds(ScaleX(WizardForm.NextButton.Left), ScaleY(WizardForm.NextButton.Top),
ScaleX(WizardForm.NextButton.Width), ScaleY(WizardForm.NextButton.Height));
OnClick:=@DblNextEvent;
Parent:=MainForm;
TabOrder:=0;
end;
WizardForm.BorderStyle:=bsNone;
WizardForm.Width:=0;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
DblNextButton.Caption:=WizardForm.NextButton.Caption;
end;
Thanks Nemko.ffmla, maybe this:
P.S .: please use spoilers for a beautiful message design.
ffmla, аll paths are open, you can do as you want.I have a doubt with the following attached code.
Runtime Error (at 259:621):
thank you so much.Could not call proc.
procedure SetTaskBarTitle(const Caption: String); external 'SetTaskBarTitle@{tmp}\layered.dll stdcall delayload';
fixed.following error when 'msvcr100.dll' is not installed in system32
не знаю зачем нужно, но пусть будет. вот.а как же SetTaskBarThumbnailTooltip?
Как зачем? Над миниатюрой чтобы название было.не знаю зачем нужно
^^ I have some doubts.fixed.
Отвязал от msvcr110.dll библиотеку.
Добавил SetupHandle (нужно для работы SetTaskBar*, достаточно вызвать один раз в самом начале всего кода).
FindWindowByClassName('TApplication')) = Application.Handle
is there any way to find entire David source code have external dependency?
How do you find this wcsstr use msvcr100 or mscvr110.dll?
function GetWindow(HWND: Longint; uCmd: cardinal): Longint; external 'GetWindow@user32.dll stdcall';
procedure InitializeWizard();
begin
// need for SetTaskBar*
SetupHandle(GetWindow(MainForm.Handle, 2));
//