Archive: Restoring window focus after Banner::destroy


Restoring window focus after Banner::destroy
Hi!

I want to use Banner::show function to replace the standard "Please wait while Setup..." string.
But how do I properly close that banner?
After I call Banner::destroy my installer window loses it's focus. How can I fix that?


BringToFront. Note however that Banner utilizes that dialog but it's not a replacement. Using Banner will not change the string displayed on installer start. If that's what you're trying to do, you'll have to reshack dialog 111.


Originally posted by aerDNA
BringToFront. Note however that Banner utilizes that dialog but it's not a replacement. Using Banner will not change the string displayed on installer start. If that's what you're trying to do, you'll have to reshack dialog 111.
I've managed to replace standard text on the banner, but my goal is to keep the installer on top after it.
BringToFront doesn't help. When I call it, the installer just begin to blink in the task bar. It doesn't move to front.

It's the "prevent applications from stealing focus" Windows feature; I tend to forget about it since I always have it disabled. You should be able to beat it with this:
System::Call "User32::SetWindowPos(i $HWNDPARENT, i -1, i 0, i 0, i 0, i 0, i 3) i."


Originally posted by aerDNA
BringToFront. Note however that Banner utilizes that dialog but it's not a replacement. Using Banner will not change the string displayed on installer start. If that's what you're trying to do, you'll have to reshack dialog 111.
And what about using reshack?
I've found and replaced the "Please wait while Setup..." string in the Contrib\UIs\modern.exe.
But where can I found the "verifying installer" string? Is recompiling NSIS the only way to change it?

That one is in Stubs\zlib (or whichever you're using); you can hex edit it.


Originally posted by aerDNA
That one is in Stubs\zlib (or whichever you're using); you can hex edit it.
Thank you, I've found the string I need. But is it possible to insert cyrillic symbols into that file? When I patch it, I see symbols in wrong encoding during installation.

I would guess that proper locale isn't set for non-unicode programs on your test system, but in that case the whole installer would fail to display cyrillic symbols. You could replace the string with spaces, or turn crc checking off; not very beautiful solutions, I know.


I tried and succeeded in getting a Russian Cyrillic string to display properly (проверка установки = verifying installer if google translate is correct). I attached the edited zlib - if it doesn't work for you, then it's the system locale; if it does, then you didn't edit right.


It seems that we use different NSIS version.
I've tried your file, it displays proper string, but after it the installer crashes.

Also I've tried to copy your string into my file but it didn't help. In my file one letter takes two bytes and in yours it takes one byte.
Attachment 50735


I just assumed it was 2.46. Which version is it? It's obviously unicode but I can't match it with any build. Anyway, I edited your zlib, see if it makes a difference.


The above will not work, but this one will.


Originally posted by aerDNA
The above will not work, but this one will.
Thank you very much. This file works.
But could you explain which encoding did you use?

Unicode (UTF-16LE). The latin subset of unicode has the same codes as ansi, except they're 2 bytes, so when seen in hex editor, it looks like a 'regular' string interlaced with zeros. This gave you and me the wrong idea that you can just replace the latin ascii with cyrillic, but it doesn't work that way. The easiest way I guess to get the properly encoded string is to write it in notepad, save as unicode and open in hex editor; discard the first 2 bytes and the rest is your string.


Thank you!
Now I can edit those files myself :)


Originally posted by aerDNA
The latin subset of unicode has the same codes as ansi, except they're 2 bytes, so when seen in hex editor, it looks like a 'regular' string interlaced with zeros.
Only the first 127 codepage entries (old school ASCII) are the same...