Archive: Updating progressbar via external process


Updating progressbar via external process
  Hi,
I'm curious about the best way to do this:

I need to update a progressbar based on the progress of an external executable, which handles the actual install work.

I'm using the progressbar in InstallOptionsEx. I know that in my PageUpdate function, I can have a loop that "polls" the external process (via nsexec), and updates the progressbar. However, such a loop would block other UI activity, so for example, the user would not be able to click cancel or stop the installer, until it either failed or succeeded completely.

Is there a non-blocking type of "sleep" function maybe, that will callback a function I specify after N msecs? I think something like that would solve my problem, but maybe there is a better way of doing what I'm trying to do?

Thanks


If the external process is under your control, it'd be simpler to it change the progress bar itself. If not, you can set a timer using the System plug-in and use System callbacks. There is one example in the System plug-in documentation for callbacks and one in the examples.


I've tried gleaming what I need to know out of the System plug-in examples, but no dice. I am trying:


System::Call "${sysSetTimer} (r2, 1, r8,)"
!insertmacro SINGLE_CALLBACK 20 $5 1 MyCallBack


Where r2 is $HWNDPARENT and r8 is the delay in msecs. MyCallBack is never called. Am I doing this the right way?

The plug-in example (System.nsi) has all kinds of other System::Call's, but they all seem to deal with creating the splash window, which I don't need.

You have to call something with System::Call and have it return its value on the stack to use SINGLE_CALLBACK. Calling Sleep would probably be the simplest.


Hi
I have the same problem: I need to create Timer in regular page (in MUI2 in PRE or SHOW), no with nsDialogs!
Syntax is quite simple:

System::Call "User32::SetTimer(i, i, i, k) i 

(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc) UINT_PTR"
I have only problem with that k parameter - TIMERPROC

All I need is to execute my function every uElapse miliseconds:
Function TimerTick

MessageBox MB_OK "Timer tick!"
>FunctionEnd
>
I tried GetFunctionAddress $0 TimerTick for that k parameter but no success.

Maybe I must use callback as mentioned in System plugin readme http://nsis.sourceforge.net/System_p...adme#Callbacks.

System::Get "(i .r0, i .r1) isR0"

>Pop $0
System
::Call "dll::UseCallback(k r0)"
but I am confused from that example.
I also saw included system examle, but it is even more complicated.
Can you explain me how ho call Function TimerTick with that callback?