[Setup]
AppName=Wintb.dll example
AppVersion=1.0.0.8
DefaultDirName={pf}\Wintb.dll example
DefaultGroupName=Wintb.dll example
OutputDir=.
[files]
Source: wintb.dll; Flags: dontcopy;
Source: icons\*.*; Flags: dontcopy;
;Source: iswin7.dll; Flags: dontcopy;
Source: ISSkin.dll; Flags: dontcopy;
Source: Crystal.cjstyles; Flags: dontcopy;
[code]
//#include "iswin7.iss"
#include "isskin.iss"
const
TBPF_NOPROGRESS = 0;
TBPF_INDETERMINATE = 1;
TBPF_NORMAL = 2;
TBPF_ERROR = 4;
TBPF_PAUSED = 8;
IMAGE_BITMAP = 0;
IMAGE_ICON = 1;
USENONE = 0;
USEAERO = 1;
USESKIN = 2;
LR_LOADFROMFILE = $0010;
// wintb.dll
procedure WintbStart(); external 'WintbStart@{tmp}\wintb.dll cdecl delayload';
procedure WintbStop(); external 'WintbStop@{tmp}\wintb.dll cdecl delayload';
procedure SetTaskBarProgressValue(Value: Longint); external 'SetTaskBarProgressValue@{tmp}\wintb.dll cdecl delayload';
procedure SetTaskBarProgressState(Value: Longint); external 'SetTaskBarProgressState@{tmp}\wintb.dll cdecl delayload';
procedure SetTaskBarTitle(const Caption: PAnsiChar); external 'SetTaskBarTitle@{tmp}\wintb.dll cdecl delayload';
procedure SetTaskBarThumbnailTooltip(const Hint: PAnsiChar); external 'SetTaskBarThumbnailTooltip@{tmp}\wintb.dll cdecl delayload';
procedure SetTaskBarOverlayIcon(Icon: Longint); external 'SetTaskBarOverlayIcon@{tmp}\wintb.dll cdecl delayload';
function TaskBarAddButton(Image, ImageType: Longint; Hint: PAnsiChar; Event: Longint; Border: Boolean): Longint; external 'TaskBarAddButton@{tmp}\wintb.dll cdecl delayload';
procedure TaskBarCreateButtons(); external 'TaskBarCreateButtons@{tmp}\wintb.dll cdecl delayload';
procedure TaskBarButtonEnabled(Button: Longint; Enabled: Boolean); external 'TaskBarButtonEnabled@{tmp}\wintb.dll cdecl delayload';
procedure TaskBarButtonToolTip(Button: Longint; Hint: PAnsiChar); external 'TaskBarButtonToolTip@{tmp}\wintb.dll cdecl delayload';
procedure TaskBarButtonImage(Button, Image, ImageType: Longint); external 'TaskBarButtonImage@{tmp}\wintb.dll cdecl delayload';
procedure Win6TaskBarV1_0A(WForm, MForm: HWND; Time: Longint); external 'Win6TaskBarV1_0A@{tmp}\wintb.dll cdecl delayload';
procedure Win6TaskBarV1_0B(WForm, MForm: HWND; Time, p1, p2, p3, p4: Longint); external 'Win6TaskBarV1_0B@{tmp}\wintb.dll cdecl delayload';
procedure Win6TaskBarV1_0C(WForm, MForm: HWND; Time, p1, p2: Longint); external 'Win6TaskBarV1_0C@{tmp}\wintb.dll cdecl delayload';
procedure Win6TaskBarV1_1(WForm: HWND); external 'Win6TaskBarV1_1@{tmp}\wintb.dll cdecl delayload';
procedure Win6TaskBarV1_2(WForm, MForm: HWND; Mode: Longint); external 'Win6TaskBarV1_2@{tmp}\wintb.dll cdecl delayload';
// winapi
function LoadImage(hInst: Longint; ImageName: PAnsiChar; ImageType, X, Y, Flags: Longint): Longint; external 'LoadImageA@user32.dll stdcall';
function DestroyIcon(hIcon: Longint): BOOL; external 'DestroyIcon@user32.dll stdcall';
function DeleteObject(hObj: Longint): BOOL; external 'DeleteObject@gdi32.dll stdcall';
var
hBack, hNext, hCancel, hInfo: Longint;
hImg1, hImg2, hImg3, hImg4, hImg5: Longint;
procedure BtnOnClick(Button: Longint);
begin
case Button of
hBack: WizardForm.BackButton.OnClick(WizardForm.BackButton);
hNext: WizardForm.NextButton.OnClick(WizardForm.NextButton);
hCancel: WizardForm.CancelButton.OnClick(WizardForm.CancelButton);
hInfo: MsgBox('Wintb.dll example', mbInformation, MB_OK);
end;
end;
procedure InitializeWizard();
begin
ExtractTemporaryFile('wintb.dll');
//ExtractTemporaryFile('iswin7.dll');
ExtractTemporaryFile('1.ico');
ExtractTemporaryFile('2.ico');
//ExtractTemporaryFile('3.ico');
//ExtractTemporaryFile('4.ico');
//ExtractTemporaryFile('1.bmp');
//ExtractTemporaryFile('2.bmp');
ExtractTemporaryFile('3.bmp');
ExtractTemporaryFile('4.bmp');
ExtractTemporaryFile('5.bmp');
WintbStart();
SetTaskBarProgressValue(40);
SetTaskBarProgressState(TBPF_PAUSED);
SetTaskBarTitle('Приветствие'); // работает в win xp
SetTaskBarThumbnailTooltip('Пример wintb v8');
hImg1 := LoadImage(0, ExpandConstant('{tmp}\1.ico'), IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
hImg2 := LoadImage(0, ExpandConstant('{tmp}\2.ico'), IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
hImg3 := LoadImage(0, ExpandConstant('{tmp}\3.bmp'), IMAGE_BITMAP, 16, 16, LR_LOADFROMFILE);
hImg4 := LoadImage(0, ExpandConstant('{tmp}\4.bmp'), IMAGE_BITMAP, 16, 16, LR_LOADFROMFILE);
hImg5 := LoadImage(0, ExpandConstant('{tmp}\5.bmp'), IMAGE_BITMAP, 16, 16, LR_LOADFROMFILE);
SetTaskBarOverlayIcon(hImg2); // только ico
hBack := TaskBarAddButton(hImg1, IMAGE_ICON, '< Назад', CallbackAddr('BtnOnClick'), true); // ico или bmp
hNext := TaskBarAddButton(hImg2, IMAGE_ICON, 'Далее >', CallbackAddr('BtnOnClick'), true); // 7 штук максимум
hCancel := TaskBarAddButton(hImg3, IMAGE_BITMAP, 'Отмена установки', CallbackAddr('BtnOnClick'), true);
hInfo := TaskBarAddButton(hImg5, IMAGE_BITMAP, 'Info', CallbackAddr('BtnOnClick'), true);
TaskBarCreateButtons;
//example 1
//Win6TaskBarV1_0A(WizardForm.Handle, MainForm.Handle, 100);
//example 2
// совместимо с iswin7.dll:
//iswin7_create;
//Win6TaskBarV1_0B(WizardForm.Handle, MainForm.Handle, 100, 0, 0, 0, 47);
//example 3
// совместимо с isskin.dll
//Win6TaskBarV1_0C(WizardForm.Handle, MainForm.Handle, 100, 27, 6);
//example 4
// не поддерживает остальные плюшки
//Win6TaskBarV1_1(WizardForm.Handle);
//example 5
//iswin7_create;
Win6TaskBarV1_2(WizardForm.Handle, MainForm.Handle, USESKIN);
end;
procedure CurPageChanged(CurPageID: Integer);
begin
case CurPageID of
wpWelcome: begin
TaskBarButtonEnabled(hback, false);
SetTaskBarTitle('Приветствие');
end;
wpSelectDir: begin
TaskBarButtonEnabled(hback, true);
TaskBarButtonImage(hnext, hImg2, IMAGE_ICON);
TaskBarButtonToolTip(hnext, 'Далее >');
SetTaskBarTitle('Выбор каталога');
end;
wpReady: begin
TaskBarButtonImage(hnext, hImg4, IMAGE_BITMAP);
TaskBarButtonToolTip(hnext, 'Установить');
SetTaskBarTitle('Все готово');
end;
wpInstalling: begin
TaskBarButtonEnabled(hback, false);
TaskBarButtonEnabled(hnext, false);
SetTaskBarTitle('Установка');
end;
wpFinished: begin
TaskBarButtonEnabled(hnext, true);
TaskBarButtonEnabled(hcancel, false);
TaskBarButtonToolTip(hnext, 'Завершить');
TaskBarButtonToolTip(hcancel, 'Выход');
SetTaskBarTitle('Завершение');
end;
end;
end;
procedure DeinitializeSetup();
begin
// iswin7_free;
ShowWindow(WizardForm.Handle, SW_HIDE);
UnloadSkin;
WintbStop;
DestroyIcon(hImg1);
DestroyIcon(hImg2);
DeleteObject(hImg3);
DeleteObject(hImg4);
DeleteObject(hImg5);
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
TaskBarButtonEnabled(hback, false);
TaskBarButtonEnabled(hnext, false);
TaskBarButtonEnabled(hcancel, false);
Confirm:=false;
end;