Archive: how to show informative dialog in OnInit


how to show informative dialog in OnInit
I've a script that acts as liveupdate for a bigger application. Most code is inside .OnInit function (no section, at least just one section but it's empty).
At a certain point i check if a program is running and i loop until either the user closes it or the loop has run for 30 seconds (after that, it closes the application and main installer is launched).
Well: at present , during loop i show a banner (using msibanner) just to display a message to the user saying application is running: close it within 30 seconds...).

Of course, using msibanner is not nice as i don't need progress bar (just inform the user); in addition the dialog is small in size.
What i need is a standard windows dialog with the message; better it would be it can be dynamically changed.

I can't use page (i'm inside oninit) and i can't move the code in a section (even tried this) because this way i see the installer dialog. In this case i should set always silent but then nothing is shown (i'm using inetload and i do want to show its own dialog).

Even InstallOptions/InstallOptionsEx of course are not appliable.

I'm quite sure it's possible to have a simple dialog - no banner, no progress bar, no input fields. I searched the forum without success. Any hints appreciated.
thanks in advance.


You could place your code in an installer section.

Then use Ressource Hacker to customize the install files dialog to fit your needs. For instance just copy the modern.exe from your nsis\contrib\UI\ folder for instance to "mymodified.exe" and then customize the install files dialog (probably dialog 106) using resource hacker.

If I was you I probably would use the given listview control in the install files dialog for information output. Later on you could use the command

DetailPrint

to give the user some feedback about whats going on.

Done that, you could use the ChangeUI command to use your modified dialog instead of the usual dialog in your installer:

!insertmacro MUI_PAGE_INSTFILES

ChangeUI IDD_INSTFILES "mymodified.exe"

Section ""
; do whatever you want to do here
; e.g. use detailprint to give the user some informations
Sectionend


Take a look at the nsis updater script which gives perfect hints on the subject of building an internet updater:

http://cvs.sourceforge.net/viewcvs.p...ttic=0#dirlist

Tried using the Banner plugin?
Contrib\Banner

-Stu


no mui, maybe the banner...
thanks Maester but i don't use mui at all.
thanks Afrow: on early phase i tried banner but for some reason it didn't suite my needs. don't remember well right now: probably the size (too smal), or something related to the CRLF ($\r$\n) not working when showing the banner, or something else.
I'll give probably another try with the banner plugin; anyway , in MMO it's strange a 'simple' dialog is not a built-in feature (but maybe i'm oversizing the scope of nsi, not sure).
thanks again.


Re: no mui, maybe the banner...

thanks Maester but i don't use mui at all.
You dont have to use MUI. Works with the classic gui as well.
Just take a look in the UI folder. There are a lot of ui you can customize using Resource Hacker including the classic ui.

Why building a new dialog if there is already one you could customize? If you use the install files dialog you easely could use the nsis built in commands to set the dialog title before and after the action. Additionally you could use the given listview as your output field to show the user some informations at runtime.

It all depends on what controls you wish to have on your dialog and how it should look like.

Just my 2 cents,
Mæster.

Re: no mui, maybe the banner...

Originally posted by jsbach
thanks Maester but i don't use mui at all.
thanks Afrow: on early phase i tried banner but for some reason it didn't suite my needs. don't remember well right now: probably the size (too smal), or something related to the CRLF ($\r$\n) not working when showing the banner, or something else.
I'll give probably another try with the banner plugin; anyway , in MMO it's strange a 'simple' dialog is not a built-in feature (but maybe i'm oversizing the scope of nsi, not sure).
thanks again.
If the text labels are too small, then you can make them larger using Resource Hacker (DLG 111).
Make a copy of the original modern.exe first, modify it, then use ChangeUI all "path\to\modern_modified.exe"

-Stu

done but field not resized...
thanks afrow. now i have mymodern.exe whit dlg 111 modified: just a little bit enlarged both dialog and control, icon just moved.
with sendmessage i see text changing inside the new ui but i still have a problem: even if i resized&compiled without error the dialog with reshack, i see the field like it were unchanged (i see text 'cut' at right and going below).
Like text i'm sending not wrapping inside the larger control.
now studying why......


this the properties:
111 DIALOGEX 0, 0, 191, 113
STYLE DS_ABSALIGN | DS_SYSMODAL | DS_FIXEDSYS | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_DLGFRAME
CAPTION "Test Banner"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 10, "MS SHELL DLG"
{
CONTROL "", 1030, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE, 40, 25, 120, 10
CONTROL 103, -1, STATIC, SS_ICON | WS_CHILD | WS_VISIBLE, 6, 7, 33, 30
CONTROL "", 76, STATIC, SS_CENTER | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_TABSTOP, 39, 20, 121, 74
}


Don't forget there's two static labels on there: 1030 and 76.
I see you've only resized 76.

-Stu


yes seen too late
thanks Afrow,
unfortunately i realized that only on second check.
Now the custom notification dialog works pretty good and i'm just refining it. however i've a couple of stupid issues : (control) colors and dialog caption not set.
abstract of the macro i invoke here:
Banner::show /NOUNLOAD ""
Banner::getWindow /NOUNLOAD
Pop $1
GetDlgItem $HWND $1 1030
CreateFont $DlgFont "Arial" "9" "700"
SendMessage $HWND ${WM_SETFONT} $DlgFont 1
; SendMessage $HWND ${WM_CTLCOLOR} 0xFF0000 0x00FF00

Font changes, color not. Even tried with SetCtlColors: no way.

Even the dialog title (caption) is not shown (i've set WS_CAPTION and its text but it won't show.

Now searching the forum on that.
Thanks for your help.


I was unable to change the font colour either.

-Stu