Skip to content
⌘ NSIS Forum Archive

launching an asynchronous process and SetAutoClose true

4 posts

kalverson#

launching an asynchronous process and SetAutoClose true

I am having trouble getting a GUI application to be visible when launched from post.nsh and with SetAutoClose true. I can see the process in task manager, but there is no GUI. This only seems to work when I don't use the /ASYNC option but then the finish panel stays around until the GUI application finishes. I've also tried using an exe that launches an exe thinking to get a non-child process going, but that did not work either. Is there a way to do this? i.e. - having a separate process running and live on after the finish panel closes.

; launch pm wizard
StrCpy $1 '"$TEMP\${PRODUCT_BUNDLE_PATH}$uniquePath\pmwiz.exe'
ExecDos::exec /ASYNC $1
pop $0

StrCpy $NoFinishPage 1

SetAutoClose true

SectionEnd
Anders#
If this is a GUI app, why are you using ExecDos? Have you tried ExecShell?

As a hack you could just use HideWindow + Sleep...
kalverson#
Thanks for the tip Anders. The ExecShell did not work, but the HideWindow did work. It simulates an asynchronous launch nicely. The finish panel hides itself and then the synchronously launched GUI appears a second later. After the GUI exits, the finish panel never shows itself again and quietly disappears.
Anders#
You could also try this:

!define SEE_MASK_FLAG_DDEWAIT       0x00000100
!define SEE_MASK_WAITFORINPUTIDLE   0x02000000 ; This is the important part
StrCpy $0 "$SysDir\Calc.exe"
StrCpy $1 "" ; Parameters
!if "${NSIS_PTR_SIZE}" <= 4
System::Call '*(i60,i${SEE_MASK_FLAG_DDEWAIT}|${SEE_MASK_WAITFORINPUTIDLE},i$hwndparent,i0,tr0,tr1,i0,i5,i0,i0,i0,i0,i0,i0,i0)i.r0'
System::Call 'SHELL32::ShellExecuteEx(ir0)'
System::Free $0
!endif
Quit