WinTB

DLL WinTB 2.1

Нет прав для скачивания
Все равно надо выгружать библиотеку
Код:
procedure DeInitializeSetup;
begin
UnloadDLL(ExpandConstant('{tmp}\wintb.dll'));
end;
 
Xabib2302, ответ выше
Код:
procedure DeinitializeSetup();
begin
UnloadDLL(ExpandConstant('{tmp}\wintb.dll'));
  if iInitialize then
  begin
    gdipShutdown;
    //TaskBarDestroy;
  end;
end;
 
Hi forum members,
Anyone may help to make a simple code for strip down version of the wintb.dll(9.5kb's one).Like Sergey3695''s installer.
 
ffmla, this ?

Код:
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application

[Files]
Source: "tb.dll"; Flags: "dontcopy";
Source: "CallbackCtrl.dll"; Flags: "dontcopy";
Source: {win}\help\*; DestDir: {app}\Files; Flags: external recursesubdirs

[Code]
const
  TBPF_NOPROGRESS     = 0;
  TBPF_INDETERMINATE  = 1;
  TBPF_NORMAL         = 2;
  TBPF_ERROR          = 4;
  TBPF_PAUSED         = 8;

type
  PWideChar = String;
  TPBProc   = function (h: hWnd; Msg, wParam, lParam: Longint): Longint;

var
  eTime,sTime: DWORD;
  PBOldProc: Longint;
  WFCaption: string;
// tb.dll
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';//
//win api
function  SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external 'SetWindowLongA@user32.dll stdcall';
function  CallBackProc(P: TPBProc; ParamCount: Integer): LongWord; external 'wrapcallbackaddr@files:CallbackCtrl.dll stdcall';
function  CallWindowProc(lpPrevWndFunc: Longint; hWnd: HWND; Msg: UINT; wParam, lParam: Longint): Longint; external 'CallWindowProcA@user32.dll stdcall';
function  GetTickCount: DWORD; external 'GetTickCount@kernel32.dll stdcall';
procedure DeInitTB; forward;

function InitializeSetup: Boolean;
begin
  if not FileExists(ExpandConstant('{tmp}\tb.dll')) then ExtractTemporaryFile('tb.dll');
  if not FileExists(ExpandConstant('{tmp}\CallbackCtrl.dll')) then ExtractTemporaryFile('CallbackCtrl.dll');
  Result:=True;
end;

function LongintToStringTime(t: Longint):string;
var
  h,m,s:integer;
begin
  h:=t div 3600;
  t:=t-h*3600;
  m:=t div 60;
  s:=t-m*60;
  Result:='';
  if h>0 then Result:=Result+IntToStr(h)+' ч. ';
  if (m>0) or (h>0) then Result:=Result+IntToStr(m)+' мин. ';
  if (m>0) or (h>0) or (s>0) then Result:=Result+IntToStr(s)+' сек.';
end;

function PBProc(h:hWnd;Msg,wParam,lParam:Longint):Longint;
var
  dt,at,pr,i1,i2: Extended;
  lt: Longint;
  p: String;
  tc: DWORD;
begin
  Result:=CallWindowProc(PBOldProc,h,Msg,wParam,lParam);
  if (Msg=$402) and (WizardForm.ProgressGauge.Position>WizardForm.ProgressGauge.Min) then begin
    i1:=WizardForm.ProgressGauge.Position-WizardForm.ProgressGauge.Min;
    i2:=WizardForm.ProgressGauge.Max-WizardForm.ProgressGauge.Min;

    pr:=i1*100/i2;
    p:=Format('%f',[pr])+'%';
    StringChange(p,',','.');
    SetTaskBarThumbnailTooltip(p); //Set caption (Hint caption, at OnMouseEnter on miniature) for TaskBarProgress
    SetTaskBarProgressValue(Round(pr)); //Set position for TaskBarProgress
    SetTaskBarThumbnailClip(ScaleX(0), ScaleX(0), ScaleX(40), ScaleY(80)); //Resize miniature

    tc:=GetTickCount;
    if (tc-eTime)>=1000 then begin
      dt:=(tc-sTime)/1000;
      at:=i2*dt/i1;
      lt:=Round(at-dt);
      SetTaskBarTitle('Жди ~ '+LongintToStringTime(lt)+' ('+p+').'); //Set caption for TaskBarProgress
      eTime:=tc;
    end;
  end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  case CurStep of
    ssInstall: begin
      WFCaption:=WizardForm.Caption;
      SetTaskBarProgressValue(1000); //Set max value for TaskBarProgress
      sTime:=GetTickCount; eTime:=sTime;
      PBOldProc:=SetWindowLong(WizardForm.ProgressGauge.Handle,-4,CallBackProc(@PBProc,4));
    end;
    ssPostInstall: DeInitTB;
  end;
end;

procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
if CurPageID=wpInstalling then begin
  Confirm:=False;
  Cancel:=ExitSetupMsgBox;
  if Cancel then DeInitTB;
 end;
end;

procedure DeInitTB;
begin
  SetWindowLong(WizardForm.ProgressGauge.Handle, -4, PBOldProc);
  WizardForm.Caption:=WFCaption;
end;
 
ffmla, this ?

Код:
 [Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application

[Files]
Source: "tb.dll"; Flags: "dontcopy";
Source: "CallbackCtrl.dll"; Flags: "dontcopy";
Source: {win}\help\*; DestDir: {app}\Files; Flags: external recursesubdirs

[Code]
const
  TBPF_NOPROGRESS     = 0;
  TBPF_INDETERMINATE  = 1;
  TBPF_NORMAL         = 2;
  TBPF_ERROR          = 4;
  TBPF_PAUSED         = 8;

type
  PWideChar = String;
  TPBProc   = function (h: hWnd; Msg, wParam, lParam: Longint): Longint;

var
  eTime,sTime: DWORD;
  PBOldProc: Longint;
  WFCaption: string;
// tb.dll
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';//
//win api
function  SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external 'SetWindowLongA@user32.dll stdcall';
function  CallBackProc(P: TPBProc; ParamCount: Integer): LongWord; external 'wrapcallbackaddr@files:CallbackCtrl.dll stdcall';
function  CallWindowProc(lpPrevWndFunc: Longint; hWnd: HWND; Msg: UINT; wParam, lParam: Longint): Longint; external 'CallWindowProcA@user32.dll stdcall';
function  GetTickCount: DWORD; external 'GetTickCount@kernel32.dll stdcall';
procedure DeInitTB; forward;

function InitializeSetup: Boolean;
begin
  if not FileExists(ExpandConstant('{tmp}\tb.dll')) then ExtractTemporaryFile('tb.dll');
  if not FileExists(ExpandConstant('{tmp}\CallbackCtrl.dll')) then ExtractTemporaryFile('CallbackCtrl.dll');
  Result:=True;
end;

function LongintToStringTime(t: Longint):string;
var
  h,m,s:integer;
begin
  h:=t div 3600;
  t:=t-h*3600;
  m:=t div 60;
  s:=t-m*60;
  Result:='';
  if h>0 then Result:=Result+IntToStr(h)+' ч. ';
  if (m>0) or (h>0) then Result:=Result+IntToStr(m)+' мин. ';
  if (m>0) or (h>0) or (s>0) then Result:=Result+IntToStr(s)+' сек.';
end;

function PBProc(h:hWnd; Msg,wParam,lParam:Longint):Longint;
var
  dt,at,pr,i1,i2: Extended;
  lt: Longint;
  p: String;
  tc: DWORD;
begin
  Result:=CallWindowProc(PBOldProc,h,Msg,wParam,lParam);
  if (Msg=$402) and (WizardForm.ProgressGauge.Position>WizardForm.ProgressGauge.Min) then begin
    i1:=WizardForm.ProgressGauge.Position-WizardForm.ProgressGauge.Min;
    i2:=WizardForm.ProgressGauge.Max-WizardForm.ProgressGauge.Min;

    pr:=i1*100/i2;
    p:=Format('%f',[pr])+'%';
    StringChange(p,',','.');
    SetTaskBarThumbnailTooltip(p); //Set caption (Hint caption, at OnMouseEnter on miniature) for TaskBarProgress
    SetTaskBarProgressValue(Round(pr)); //Set position for TaskBarProgress
    SetTaskBarThumbnailClip(ScaleX(0), ScaleX(0), ScaleX(40), ScaleY(80)); //Resize miniature

    tc:=GetTickCount;
    if (tc-eTime)>=1000 then begin
      dt:=(tc-sTime)/1000;
      at:=i2*dt/i1;
      lt:=Round(at-dt);
      SetTaskBarTitle('Жди ~ '+LongintToStringTime(lt)+' ('+p+').'); //Set caption for TaskBarProgress
      eTime:=tc;
    end;
  end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  case CurStep of
    ssInstall: begin
      WFCaption:=WizardForm.Caption;
      SetTaskBarProgressValue(1000); //Set max value for TaskBarProgress
      sTime:=GetTickCount; eTime:=sTime;
      PBOldProc:=SetWindowLong(WizardForm.ProgressGauge.Handle,-4,CallBackProc(@PBProc,4));
    end;
    ssPostInstall: DeInitTB;
  end;
end;

procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
if CurPageID=wpInstalling then begin
  Confirm:=False;
  Cancel:=ExitSetupMsgBox;
  if Cancel then DeInitTB;
 end;
end;

procedure DeInitTB;
begin
  SetWindowLong(WizardForm.ProgressGauge.Handle, -4, PBOldProc);
  WizardForm.Caption:=WFCaption;
end;

Thanks Nemko.
its only works on installation page.but thanks for the code. I'll try to alter it for all the pages.
Also it create small tool clip on task bar. Sorry I didn't edit.

In the above code How to add ThumbnailClip for taskbar?.
If you have a time...!! Please post it….?
 
Последнее редактирование:
Thanks Nemko.
its only works on installation page.but thanks for the code. I'll try to alter it for all the pages.
Also it create small tool clip on task bar. Sorry I didn't edit.

In the above code How to add ThumbnailClip for taskbar?.
If you have a time...!! Please post it….?
 

Вложения

Hey thanks for the example.
but one small help needed.
In this setup, During the launch of installer, wizards always inactive.{ Wizardform -active; Mainform-Inactive.}
How to make the Mainform active in the above wintb example?.
Thanks in advance.
 
Hey thanks for the example.
but one small help needed.
In this setup, During the launch of installer, wizards always inactive.{ Wizardform -active; Mainform-Inactive.}
How to make the Mainform active in the above wintb example?.
Thanks in advance.
like this:
Код:
procedure FormOnTime(h, msg, idevent, dwTime: Longword);
begin
  if GetForegroundWindow = WizardForm.Handle then
    SetForegroundWindow(MainForm.Handle);
end;

....

SetTimer(MainForm.Handle, 1, 1, WrapTimerProc(@FormOnTime, 4));
 
nik1967, там SetThumbnailClip method
выше пример без использования этого метода (example.zip) и исходники. думаю для 10-ки тут ничего не сделать. на 8.1 такого не наблюдал.
 
nik1967, тогда ничего не сделать. значит win10 показывает все окна, даже если они за областью рабочего стола. SetTaskBarThumbnailClip лишь ограничивает область показа для миниатюры. по умолчанию wizardform ее не имеет. т.е. надо править исходники inno.
 
Андрей, а у меня вот такая бяка на десятке вылазит.
https://yadi.sk/i/i05n-Zwt3aHAX5
На семерке всё ок. Восьмерки нету.
Ну это потому что 2 окна. Тут только в исходники inno лезть и удалять 1 окно
SetTaskBarThumbnailClip был добавлен если окно обрезалось по региону, чтобы можно было показать только часть окна на миниатюре. Вложил пример с обрезкой региона (недоделанный).
 

Вложения

  • script.7z
    script.7z
    183.9 KB · Просмотры: 34
А если использовать mainform как основную форму, а wizardform скрыть?
 
Эдди, дак так и делаем.
Только не скрываем визардформ, а выносим за область Left:= -10000;
 
Последнее редактирование:
Андрей, так влом разбирать твой скрипт, а можно что-нибудь попроще, типа примера твоего выше?
 
Последнее редактирование:
Андрей, так влом разбирать твой скрипт, а можно что-нибудь попроще, типа экзапля твоего выше7
Код:
SetTaskBarThumbnailClip(0, 0, WizardForm.WizardBitmapImage.Height, WizardForm.WizardBitmapImage.Width);
Это нужно когда окно без заголовка. Или например на форме слайды и нужно на миниатюре отобразить только область со слайдами
 

Вложения

  • WinTB.7z
    WinTB.7z
    15.7 KB · Просмотры: 43
  • Безымянный.jpg
    Безымянный.jpg
    227.2 KB · Просмотры: 47
Назад
Сверху