Old 27th June 2007, 11:48   #1
Innocentus
Junior Member
 
Join Date: Jun 2007
Posts: 12
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
Innocentus is offline   Reply With Quote
Old 27th June 2007, 12:10   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 27th June 2007, 12:45   #3
Innocentus
Junior Member
 
Join Date: Jun 2007
Posts: 12
Well, could you show me how to do that here:
IsWindow $0 0 loop

Thank you very much!
MfG
Inno
Innocentus is offline   Reply With Quote
Old 27th June 2007, 12:54   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Also, what if the program launch fails? You will have an infinite loop on your hands.

code:

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
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump