Inno setup disable two buttons on the same page -
disable 2 buttons on same page tried several ways did not closer example not correct [button next = time] [button back= no time (only disable)] find error bound
[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 begin wizardform.nextbutton.enabled := true; wizardform.nextbutton.caption := setupmessage(msgbuttoninstall); if timerid <> 0 killtimer(0, timerid); end else wizardform.nextbutton.caption := setupmessage(msgbuttoninstall) + inttostr(counter); end; // begin wizardform.backbutton.enabled := true; if timerid <> 0 begin if killtimer(0, timerid) 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 disablenextbutton(10); end; procedure curpagechanged6(curpageid: integer); begin if curpageid = wpselecttasks disablebackbutton(5000); end;
to disable both buttons, next button , button specified time while next button have countdown timer caption, can use following modified script based on this post
:
[setup] appname=my program appversion=1.5 defaultdirname={pf}\my program [files] source: "innocallback.dll"; destdir: "{tmp}"; flags: dontcopy [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; if counter <= 0 begin wizardform.backbutton.enabled := true; wizardform.nextbutton.enabled := true; wizardform.nextbutton.caption := setupmessage(msgbuttonnext); if timerid <> 0 killtimer(0, timerid); end else wizardform.nextbutton.caption := setupmessage(msgbuttonnext) + inttostr(counter); end; procedure disablenavigatebuttons(timeout: integer); var timercallback: longword; begin counter := timeout; wizardform.backbutton.enabled := false; wizardform.nextbutton.enabled := false; wizardform.nextbutton.caption := setupmessage(msgbuttonnext) + inttostr(counter); timercallback := wraptimerproc(@ontimertick, 4); timerid := settimer(0, 0, 1000, timercallback); end; procedure curpagechanged(curpageid: integer); begin if curpageid = wpselectdir disablenavigatebuttons(5); end;
Comments
Post a Comment