Hi,
I have to complete this task:
if a slient install is in progress at the time that the user runs a manual install, we need to display an appropriate message and possibly an hourglass image, and wait until the silent installer finishes.
during this time, the user should be able to press cancel button to exit the installer.
is there has some callback function?
Any thoughts?
silent and manual install at the same time
4 posts
Seems like all you'd have to do is create something in .onInit to detect whether or not an install was running based on whether its EXE was running. If it was, you could setup a loop to wait until (a) the user canceled or (b) the process terminated (completed).
To capture a user clicking "cancel", I'd use something like the NXS plugin since it has a cancel button already. (Plus, you could keep all your logic contained within functions called from .OnInit).
If you needed to know that it was a silent vs. just a normal install, then you might write to an INI file somewhere so that you could look for the process AND the presence of a setting in the ini file to go into 'loop mode' with your install.
To capture a user clicking "cancel", I'd use something like the NXS plugin since it has a cancel button already. (Plus, you could keep all your logic contained within functions called from .OnInit).
If you needed to know that it was a silent vs. just a normal install, then you might write to an INI file somewhere so that you could look for the process AND the presence of a setting in the ini file to go into 'loop mode' with your install.
please help me check my code
I am using this code to find whether or not the installer is running when users attempt to install.
System::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .r0 ?e"
Pop $0
StrCmp $0 0 launch
StrLen $0 "$(^Name)"
IntOp $0 $0 + 1
loop:
FindWindow $1 '#32770' '' 0 $1
IntCmp $1 0 found
System::Call "user32::GetWindowText(i r1, t .r2, i r0) i."
StrCmp $2 "$(^Name)" 0 loop
found:
so if i found one installer is in silent mode, then I have to pop up a window
nxs::Show /NOUNLOAD `$(^Name) Setup` /top `Setup installing something$\r$\nPlease wait...` /sub `$\r$\n$\r$\n Preparing...` /h 0 /pos 0 /max 100 /can 1 /end
Sleep 1000
nxs::getWindow /NOUNLOAD
Pop $0 GetDlgItem $1 $0 2 SendMessage $1 ${WM_SETTEXT} 1 "STR:&Quit" StrCpy $1 -1
doloop:
doSearch:
nxs::HasUserAborted /NOUNLOAD
Pop $0 ; $0 now contains "1" if user clicked Cancel or "0" otherwise.
StrCmp $0 1 destroy
nxs::Update /NOUNLOAD /sub "$\r$\n$\r$\n $1% complite" /pos $1 /end
IntCmp $1 0 doloop
destroy:
nxs:😁estroy
************************************
for the doloop part, should I still use
System::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .r0 ?e"
Pop $0
StrCmp $0 0 launch
StrLen $0 "$(^Name)"
IntOp $0 $0 + 1
to find window again?
could someone modify my code and make it working?
Thank you.
I am using this code to find whether or not the installer is running when users attempt to install.
System::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .r0 ?e"
Pop $0
StrCmp $0 0 launch
StrLen $0 "$(^Name)"
IntOp $0 $0 + 1
loop:
FindWindow $1 '#32770' '' 0 $1
IntCmp $1 0 found
System::Call "user32::GetWindowText(i r1, t .r2, i r0) i."
StrCmp $2 "$(^Name)" 0 loop
found:
so if i found one installer is in silent mode, then I have to pop up a window
nxs::Show /NOUNLOAD `$(^Name) Setup` /top `Setup installing something$\r$\nPlease wait...` /sub `$\r$\n$\r$\n Preparing...` /h 0 /pos 0 /max 100 /can 1 /end
Sleep 1000
nxs::getWindow /NOUNLOAD
Pop $0 GetDlgItem $1 $0 2 SendMessage $1 ${WM_SETTEXT} 1 "STR:&Quit" StrCpy $1 -1
doloop:
doSearch:
nxs::HasUserAborted /NOUNLOAD
Pop $0 ; $0 now contains "1" if user clicked Cancel or "0" otherwise.
StrCmp $0 1 destroy
nxs::Update /NOUNLOAD /sub "$\r$\n$\r$\n $1% complite" /pos $1 /end
IntCmp $1 0 doloop
destroy:
nxs:😁estroy
************************************
for the doloop part, should I still use
System::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .r0 ?e"
Pop $0
StrCmp $0 0 launch
StrLen $0 "$(^Name)"
IntOp $0 $0 + 1
to find window again?
could someone modify my code and make it working?
Thank you.
and use this snippet to test:
dloop:
FindWindow $1 '#32770' '' 0 $1
MessageBox MB_OK $1
IntCmp $1 0 destroy 0 0
intop $R0 $R0 + 1
MessageBox MB_OK $R0
nxs::Update /NOUNLOAD /sub "$\r$\n$\r$\n $R0 detects." /pos $R0 /end
nxs::HasUserAborted /NOUNLOAD
Pop $0 ; $0 now contains "1" if user clicked Cancel or "0" otherwise.
StrCmp $0 1 destroy
goto dloop
but only can loop for 7 times, after 7 time,
execute
FindWindow $1 '#32770' '' 0 $1
then $1=0, but i found the installer in silent mode is still running....
Any thoughts
dloop:
FindWindow $1 '#32770' '' 0 $1
MessageBox MB_OK $1
IntCmp $1 0 destroy 0 0
intop $R0 $R0 + 1
MessageBox MB_OK $R0
nxs::Update /NOUNLOAD /sub "$\r$\n$\r$\n $R0 detects." /pos $R0 /end
nxs::HasUserAborted /NOUNLOAD
Pop $0 ; $0 now contains "1" if user clicked Cancel or "0" otherwise.
StrCmp $0 1 destroy
goto dloop
but only can loop for 7 times, after 7 time,
execute
FindWindow $1 '#32770' '' 0 $1
then $1=0, but i found the installer in silent mode is still running....
Any thoughts