mutex - AppMutex with Inno Setup: Wait few seconds before prompt -


using inno setup appmutex works fine - when setup started , mutex still exits, user prompted close application.

but following question: there way tell inno setup wait 2-3 seconds if program closes before showing user prompt?

the reason i'm running inno setup program auto-update purpose. directly after setup file executed program closes itself, takes long (at least on systems). inno setup shows - in case - useless dialog user although program closing already.

therefore accomplish inno setup waits 2-3 seconds , if mutex still exists after time should show prompt user.

is there way accomplish this?

with such requirement, cannot use built-in appmutex directive.

you have implement mutex check using checkformutexes function:

[code]  const   mutexname = 'mutexname';  function initializesetup: boolean; var   waitinterval: integer;   wait: integer; begin   wait := 3000;    waitinterval := 250;   while (wait > 0) , checkformutexes(mutexname)   begin     log('application still running, waiting');     sleep(waitinterval);     wait := wait - waitinterval;   end;    while checkformutexes(mutexname)   begin     if msgbox(          fmtmessage(setupmessage(msgsetupapprunningerror), ['myapplication']),          mberror, mb_okcancel) <> idok     begin       abort;     end;   end;    result := true; end; 

Comments