xanloz
Цитата:
Код: [no]
[Setup]
AppName=My Program
AppVerName=My Program v.1.2
DefaultDirName={pf}\My Program
[Files]
Source: InnoCallback.dll; Flags: dontcopy
Код:
type
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);
function WrapTimerProc(callback:TProc; paramcount:integer):longword;
external 'wrapcallback@files:innocallback.dll stdcall';
function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord;
external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord;
external 'KillTimer@user32.dll stdcall';
function AddFontResource(FileName: PAnsiChar): Integer;
external 'AddFontResourceA@gdi32.dll stdcall';
function RemoveFontResource(FileName: PAnsiChar): BOOL;
external 'RemoveFontResourceA@gdi32.dll stdcall';
var
fstr: string;
lbl: TLabel;
buf: array of byte;
fnt: TFont;
TimerID: LongWord;
pfunc: LongWord;
procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
begin
lbl.Caption:= GetDateTimeString('hh:nn:ss', '-', ':');
end;
procedure InitializeWizard();
var
i: longint;
begin
#include "dfont.iss"
for i:= 0 to GetArrayLength(buf)-1 do begin
fstr:= fstr + Chr(buf[i]);
end;
SaveStringToFile(ExpandConstant('{tmp}\digital.ttf'), fstr, False);
AddFontResource(ExpandConstant('{tmp}\digital.ttf'));
SendMessage(HWND_BROADCAST,$1D,0,0);
fnt:= TFont.Create;
fnt.Name:= 'Digital';
fnt.Size:= 36;
lbl := TLabel.Create(WizardForm);
lbl.Parent:= WizardForm;
lbl.Top:= ScaleY(320);
lbl.Caption:= GetDateTimeString('hh:nn:ss', '-', ':');
lbl.Font:= fnt;
pfunc:= WrapTimerProc(@OnTimer, 4);
TimerID:= SetTimer(0, 0, 1000, pfunc);
end;
procedure DeinitializeSetup();
begin
KillTimer(0, TimerID);
RemoveFontResource(ExpandConstant('{tmp}\digital.ttf'));
SendMessage(HWND_BROADCAST,$1D,0,0);
end;
[/no]
Цитата:
а можно в инсталятор вставить цифровые часы с показом НН:ММ?-- можно. Пример из разряда юмора - [more]
Код: [no]
[Setup]
AppName=My Program
AppVerName=My Program v.1.2
DefaultDirName={pf}\My Program
[Files]
Source: InnoCallback.dll; Flags: dontcopy
Код:
type
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);
function WrapTimerProc(callback:TProc; paramcount:integer):longword;
external 'wrapcallback@files:innocallback.dll stdcall';
function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord;
external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord;
external 'KillTimer@user32.dll stdcall';
function AddFontResource(FileName: PAnsiChar): Integer;
external 'AddFontResourceA@gdi32.dll stdcall';
function RemoveFontResource(FileName: PAnsiChar): BOOL;
external 'RemoveFontResourceA@gdi32.dll stdcall';
var
fstr: string;
lbl: TLabel;
buf: array of byte;
fnt: TFont;
TimerID: LongWord;
pfunc: LongWord;
procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
begin
lbl.Caption:= GetDateTimeString('hh:nn:ss', '-', ':');
end;
procedure InitializeWizard();
var
i: longint;
begin
#include "dfont.iss"
for i:= 0 to GetArrayLength(buf)-1 do begin
fstr:= fstr + Chr(buf[i]);
end;
SaveStringToFile(ExpandConstant('{tmp}\digital.ttf'), fstr, False);
AddFontResource(ExpandConstant('{tmp}\digital.ttf'));
SendMessage(HWND_BROADCAST,$1D,0,0);
fnt:= TFont.Create;
fnt.Name:= 'Digital';
fnt.Size:= 36;
lbl := TLabel.Create(WizardForm);
lbl.Parent:= WizardForm;
lbl.Top:= ScaleY(320);
lbl.Caption:= GetDateTimeString('hh:nn:ss', '-', ':');
lbl.Font:= fnt;
pfunc:= WrapTimerProc(@OnTimer, 4);
TimerID:= SetTimer(0, 0, 1000, pfunc);
end;
procedure DeinitializeSetup();
begin
KillTimer(0, TimerID);
RemoveFontResource(ExpandConstant('{tmp}\digital.ttf'));
SendMessage(HWND_BROADCAST,$1D,0,0);
end;
[/no]