Archive: HideWindow's performance


HideWindow's performance
I've noticed that HideWindow doesn't always hide the installer window but that using it more than once seems to do the trick.
This was consistently not hiding the window after the MB was dismissed:


${If} $foo < 100
MessageBox MB_YESNO "$foo < 100. Would you like to continue?" IDYES yes IDNO no
no:
Abort
yes:
${EndIf}
HideWindow #not getting honored (the following instruction is though)

But this is working for me:

${If} $foo < 100
MessageBox MB_YESNO "$foo < 100. Would you like to continue?" IDYES yes IDNO no
no:
Abort
yes:
HideWindow #redundant but seems to help
${EndIf}
HideWindow

So far I haven't had any crashes, so it seems like using multiple HideWindow instructions when the window is already hidden is safe?

HideWindow calls ShowWindow with SW_HIDE. There's no problem calling it more than one time.

It might have not worked after the MessageBox because the window has just received focus. There are some limitations on showing and hiding windows in Windows to avoid annoying the user. For example, the SetForegroundWindow function has some of these restrictions.


Thanks kichik. I found every scenario where HideWindow wasn't working and added another call. I have 5 calls for 1 instance where I want to hide the window, and everything works fine now.