Archive: FindWindow for Dialogs


FindWindow for Dialogs
I'd like to send wm_close to my app on both install and uninstall. The problem - it is simple dialog-based app., so window class "#32770" is not unique. For example NSIS installer Modern UI windows are dialogs too. Even more - all NSIS windows have application name in title, but I'd like to keep them running :-)) Additional difficulty - in my app window title only first part (program name) is fixed.

I have idea to use GetWindowLong(GWL_USERDATA) to be sure with wm_close, but is it possible in NSIS? Any other ideas?


You can call Windows API using the System plug-in. For a tutorial see appendix C of the Users Manual.


Using WinSpy you can find the real window class name of any window.


I need to check all top level dialog boxes, this works in FindWindowEx(), but script loops... Every next FindWindow should begin from start after current handle. This is my script

Function .onInit
loop:
FindWindow $0 "#32770" "" 0 $0
IntCmp $0 0 done
IsWindow $0 0 done
System::Call "user32::GetWindowLong(i $0, i -21) i.r0"
IntCmp r0 0xFF00FF00 0 loop loop
SendMessage $0 0x0010 0 0
goto loop
done:
FunctionEnd


Your System call is overwriting $0 with the GetWindowLong result.

Try changing

System::Call "user32::GetWindowLong(i $0, i -21) i.r0"
IntCmp r0 0xFF00FF00 0 loop loop
to
System::Call "user32::GetWindowLong(i r0, i -21) i.r1"
IntCmp $1 0xFF00FF00 0 loop loop

Thanks a lot eccles!