ShellExecWait: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
mNo edit summary |
(fixed broken stack code) |
||
Line 12: | Line 12: | ||
System::Call 'shell32::ShellExecuteEx(ir0)i.r1 ?e' | System::Call 'shell32::ShellExecuteEx(ir0)i.r1 ?e' | ||
${If} $1 <> 0 | ${If} $1 <> 0 | ||
System::Call '*$0( | System::Call '*$0(is,i,i,i,i,i,i,i,i,i,i,i,i,i,ir1)' ;stack value not really used, just a fancy pop ;) | ||
System::Call 'kernel32::WaitForSingleObject(ir1,i-1)' | System::Call 'kernel32::WaitForSingleObject(ir1,i-1)' | ||
System::Call 'kernel32::GetExitCodeProcess(ir1s,*i.r1)' | System::Call 'kernel32::GetExitCodeProcess(ir1s,*i.r1)' |
Revision as of 18:57, 29 March 2010
Author: Anders (talk, contrib) |
Basic code for waiting on a "ExecShell" (Note that you can only wait on programs, not documents or URL's)
!include LogicLib.nsh !include WinMessages.nsh #define SEE_MASK_NOCLOSEPROCESS 0x40 System::Call '*(&i60)i.r0' System::Call '*$0(i 60,i 0x40,i $hwndparent,i,t "calc.exe",i ,i,i ${SW_SHOW})i.r0' System::Call 'shell32::ShellExecuteEx(ir0)i.r1 ?e' ${If} $1 <> 0 System::Call '*$0(is,i,i,i,i,i,i,i,i,i,i,i,i,i,ir1)' ;stack value not really used, just a fancy pop ;) System::Call 'kernel32::WaitForSingleObject(ir1,i-1)' System::Call 'kernel32::GetExitCodeProcess(ir1s,*i.r1)' System::Call 'kernel32::CloseHandle(is)' ${Else} pop $1 ${EndIf} System::Free $0 MessageBox mb_ok "exitcode or error=$1"