禁用同一页面上的两个按钮我尝试了几种方法,但没有得到更接近这个示例不正确 [button next = with time] [button back= no time (only disable)] 帮助找到错误绑定
[Code]
var
Counter: Integer;
TimerID: Integer;
type
TTimerProc = procedure(Wnd: HWND; Msg: UINT; TimerID: UINT_PTR;
SysTime: DWORD);
function WrapTimerProc(Callback: TTimerProc; ParamCount: Integer): LongWord;
external 'wrapcallback@files:InnoCallback.dll stdcall';
function SetTimer(hWnd: HWND; nIDEvent, uElapse: UINT;
lpTimerFunc: UINT): UINT; external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd: HWND; uIDEvent: UINT): BOOL;
external 'KillTimer@user32.dll stdcall';
procedure OnTimerTick(Wnd: HWND; Msg: UINT; TimerID: UINT_PTR;
SysTime: DWORD);
begin
Counter := Counter - 1;
begin
Counter := Counter - 1;
if Counter <= 0 then
begin
WizardForm.NextButton.Enabled := True;
WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall);
if TimerID <> 0 then
KillTimer(0, TimerID);
end
else
WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall) +
IntToStr(Counter);
end;
// begin
WizardForm.BackButton.Enabled := True;
if TimerID <> 0 then
begin
if KillTimer(0, TimerID) then
TimerID := 0;
end;
end;
procedure DisableNextButton(Timeout: Integer);
var
TimerCallback: LongWord;
begin
Counter := Timeout;
WizardForm.NextButton.Enabled := False;
WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall) + IntToStr(Counter);
TimerCallback := WrapTimerProc(@OnTimerTick, 4);
TimerID := SetTimer(0, 0, 1000, TimerCallback);
end;
procedure DisableBackButton(Timeout: UINT);
var
TimerCallback: LongWord;
begin
WizardForm.BackButton.Enabled := False;
TimerCallback := WrapTimerProc(@OnTimerTick, 4);
TimerID := SetTimer(0, 0, Timeout, TimerCallback);
end;
procedure CurPageChanged5(CurPageID: Integer);
begin
if CurPageID = wpSelectTasks then
DisableNextButton(10);
end;
procedure CurPageChanged6(CurPageID: Integer);
begin
if CurPageID = wpSelectTasks then
DisableBackButton(5000);
end;