Archive: Show MessageBox during ExecWait and close when finished?


Show MessageBox during ExecWait and close when finished?
  Hi,

I am thinking about an option of which I am not certain if it is possible?

I would like to show up a (top-most) messagebox (with a progressbar if possible) while there are several operations being executed via ExecWait.

When they are finished the messagebox should be closed and the user may proceed with the "normal" installer page.

Is it possible?
If so, how?

Thanks,

Gunther


Look at the banner plugins. NXS has a progress bar, for example.


MSG,

Originally posted by MSG
Look at the banner ...
thanks for the right keyword.

But as I do not want to use any additional files, I wonder if it would be possible to achieve the goal by another way?

Maybe my idea wasn't the best.

So here is what I want to achieve:
On a custom page of my installer the user has the option to scan his whole HDD. And as this may take up to several minutes without showing any progress on the page (frozen) I would like to indicate the user that the installer is still working (and not crashed).

Also the page does not get updated until the locate function finished.
Therefor I thought of some kind of "splashscreen" or messagebox. And as a maximum of comfort including a progressbar to indicate the activity.

Any ideas how to do this best, or the easiest way?

Thanks,

Gunther

What do you mean by additional files... third party? Use the Banner plug-in included with NSIS?

Stu


Stu,

Originally posted by Afrow UK
Use the Banner plug-in included with NSIS?
thanks for the hint.

I guess I should go to bed ..., if I can't find out myself that there is a plugin included in the NSIS package.

I was somehow "irritated" by the tip to use the NXS plugin - sorry.

Thanks,

Gunther

New day - new question(s) ... :p

I now use the included Banner plug-in with this code:

Banner::show /NOUNLOAD /set 76 "Scanning HDD ..." ""

>Banner::getWindow /NOUNLOAD
Pop$1
GetDlgItem$2 $1 1030

>...

>Banner::destroy
>
So far so good.

Tha bad thing at the moment is, that if you click somewhere outside of the banner, it disappears (and can't be shown again).

Therefor I would like to
  1. hide the "normal" installer window
  2. show only the banner

I tried things like

Banner::getWindow /NOUNLOAD

Pop$1
GetDlgItem$2 $1 1030
BringToFront
System
::Call "User32::SetWindowPos(i, i, i, i, i, i, i) b ($1, -1, 0, 0, 0, 0, ${SWP_NOMOVE}|${SWP_NOSIZE})"
to make the banner a top-most window, but with no success.

Just to check if I got it right:
The banner (window) is a second window, which is independent from the "normal" installer window, right?
If so, what do I have to do to hide (or lock at least) the normal installer window and just show the banner window (as top-most)?

Thanks for any help,

Gunther

Originally posted by Netsurfer24
Tha bad thing at the moment is, that if you click somewhere outside of the banner, it disappears (and can't be shown again).
This is not supposed to happen. Can you show a minimal script that demonstrates this effect?

Originally posted by MSG
This is not supposed to happen. Can you show a minimal script that demonstrates this effect?
Take the code I posted in #6 (http://forums.winamp.com/showpost.ph...85&postcount=6) in the first box and use it on any custom page. Add i.e. a function call to a locate function inbetween.

The banner is shown, but if you click outside the banner it disappears.

Addition 1:
The problem seems to be that when clicking inside the installer window it does not response. So after a second click in the window title the system message "(no response)" (sorry, don't know how it is called in English as I use German locale. But it is the system message when a program hangs or does not respond) appears and the banner disappears.

Gunther

PS: Is there any other documentation of the Banner plug-in than http://nsis.sourceforge.net/Docs/Banner/Readme.txt?

Originally posted by Netsurfer24
Take the code I posted in #6
I doubt that very much. Have you tried a minimal installer with only that code?

Originally posted by Netsurfer24
Is there any other documentation of the Banner plug-in than http://nsis.sourceforge.net/Docs/Banner/Readme.txt?
There are examples in your Examples directory.

Update ...

I came a little further ...

I simplified the code to:


Banner::show /NOUNLOAD /set 76 "Scanning HDD ..." "Scan in progress"

>Banner::getWindow /NOUNLOAD
Pop$1
System
::Call "User32::SetWindowPos(i $1, i -1, i 0, i 0, i 0, i 0, i 83)"
>HideWindow
...
>ShowWindow $HWNDPARENT ${SW_SHOW}
>BringToFront
Banner::destroy
>
This is (mainly) what I wanted to achieve! :)

When the function is called the
- installer window is hidden
- the banner is shown up and set to topmost (by the second parameter set to -1) and window is deactivated (last parameter set to to 83 which is
SWP_NOSIZE 0x0001
SWP_NOMOVE 0x0002
SWP_NOACTIVATE 0x0010
SWP_SHOWWINDOW 0x0040

When the subfunction has finished the installer window is shown again and the banner is destroyed.

BringToFront at least brings the installer window back to front :p just in case the user has clicked in the meanwhile because then the focus got lost.

There are examples in your Examples directory.
Yes I know. This example shows "nothing" - not even a sample for the things mentioned in the Readme like
Some More Tricks
----------------

If you use /set to set the main string (IDC_STR, 1030) you can specify a different string for the window's caption and for the main string.

If you use an empty string as the main string (Banner::show "") the banner window will not show on the taskbar.
I have the opposite question: How will the banner window be shown on the taskbar?

At the moment it is not shown. So during the banner is shown there is no entry on the taskbar, just in the task manager (ALT + Tab).

Thanks,

Gunther

You should be setting the WS_EX_TOPMOST style instead. You can use the nsDialogs macro to do this. The banner will show in the task bar when used in a silent install.

Stu


Stu,

Originally posted by Afrow UK
You should be setting the WS_EX_TOPMOST style instead. You can use the nsDialogs macro to do this.
What's the difference to my method?
MS says
WS_EX_TOPMOST Specifies that a window created with this style should be placed above all nontopmost windows and stay above them even when the window is deactivated. An application can use the SetWindowPos member function to add or remove this attribute.
Sounds to me equal to my setting, or not?

The banner will show in the task bar when used in a silent install.
Only in a silent install, or is there a way to also show it up when the installer window is hidden?

Gunther

Setting the flag is more elegant in my opinion. As for showing the application in the task bar you need to set the WS_EX_APPWINDOW style before showing the window (if the window is already shown you need to hide it, set WS_EX_APPWINDOW and show it again).

Stu


Stu,

thanks for your helpful reply (as always).

Originally posted by Afrow UK
Setting the flag is more elegant in my opinion.
Ah, OK. Thought I understood something wrong ...

As for showing the application in the task bar you need to set the WS_EX_APPWINDOW style before showing the window (if the window is already shown you need to hide it, set WS_EX_APPWINDOW and show it again).
Hmmm ..., I have read on the MSDN site, googled and found another thread here in the forum (http://forums.winamp.com/showpost.ph...4&postcount=11), but I still have not figured out how to this with the banner window - sorry.

The banner window is created by Banner::show and if I got you right, I have to add the
style before showing the window
. But how to do this? If the window does not exist yet, I can't get it's handle (because there is none). And without the handle where to set the style to? :confused:

Would be very kind of you (or somebody else) if could just explain this a little more :) - thanks!

Gunther

I've already explained you can set the (extended) styles using nsDialogs. I have looked it up for you and you want ${NSD_AddExStyle}. You already have a handle to the window as you used it for the SetWindowPos alternative. As for your last question, did you miss the last part of my post? You need to hide the window (ShowWindow with ${SW_HIDE}), set the extended style, and then show it again (${SW_SHOW}) if the window is already visible.

Stu


Stu,

thanks a lot - it works!
Please keep in mind that I am totally new to NSIS. It's the first time I get in touch with it. And as I am more a webdeveloper I also have little to no knowledge of any kind of Windows programming (VB, C#, C++). Therefor some things take a little longer ...!

But with the great help of this forum and its users I managed every problem up to now.

There is only one small blemish left.
As the banner window now shows on the taskbar, the shown name is handle ID. How can I change this i.e. to the name of the installer?

Thanks,

Gunther

PS: Do I also have (or is it possible) to use the nsDialogs macros if I want to (ex)change the icon (ID 103) of the banner?
Is it ${NSD_ClearIcon} and ${NSD_SetIcon}? Has the icon to be cleared first?


Try setting the caption of the banner using NSD_SetText.

You don't need to clear the image first. That is just if you don't want to show it anymore. You should use NSD_FreeIcon on the icon handle though in .onGUIEnd but this isn't entirely necessary.

Stu