Innocentus
27th June 2007 12:48 UTC
Script-Problem: Waiting for Window
Dear Friends,
the following script-part should be responsible for waiting until a window with the caption "xxx" is shown and closes the splashscreen with a call on newadvsplash::stop then.
NSIS-CODE:
"
[...]
TheEnd:
Call func
SectionEnd
Function func
loop:
sleep 10
FindWindow $0 "" "xxx"
IsWindow $0 0 loop
System::Call 'user32::SetForegroundWindow(i r0)'
newadvsplash::stop
FunctionEnd
"
But it doesnt work:
The splash is closed before the window is shown.
Please help me!
Thank you very much
With best regards!
MfG
Inno
Afrow UK
27th June 2007 13:10 UTC
Perhaps it would be better to compare the FindWindow value with 0 with StrCmp instead. Also the Sleep should probably be increased to 500ms at least (otherwise your code is being executed 100 times a second).
Stu
Innocentus
27th June 2007 13:45 UTC
Well, could you show me how to do that here:
IsWindow $0 0 loop
Thank you very much!
MfG
Inno
Afrow UK
27th June 2007 13:54 UTC
Also, what if the program launch fails? You will have an infinite loop on your hands.
StrCpy $1 0
loop:
StrCmp $1 10000 exit
IntOp $1 $1 + 1
Sleep 500
FindWindow $0 "" "xxx"
StrCmp $0 0 loop
exit:
System::Call 'user32::SetForegroundWindow(i r0)'
newadvsplash::stop
Stu