Archive: Setting background color of dialogs (using MUI)?


Setting background color of dialogs (using MUI)?
I know there have been other posts relating to this topic, but they seem to be about setting the background color of controls within a dialog and not setting the background color of the dialog itself. I need the color of my MUI based installer to be white instead of the Window's default.

I have gotten most of the way there by using a call to:

SetCtlColors $HWNDPARENT "" ffffff

within the MUI's MUI_INITGUI_BASIC macro (system.nsh). The problem is, on pages that include controls from the various dialogs defined in the modern.exe UI (i.e. the license controls, the component selection controls, etc.), the background not used by the controls themselves is still the Window's default.

There's a couple of caveats:

1) Using reshacker.exe, I have enlarged the main installer window by altering the size of the 105 Dialog (modern_headerbmp.exe) and moving around the contained controls accordingly. This includes the 1018 WS_BLACKRECT control which seems to define the relative location of all the subsequent controls defined within modern.exe.

2) I have also enlarged the sizes of the dialogs and controls within the modern.exe that I use. But haven't changed the size of the 105 dialog within the modern.exe, since it doesn't seem to make a difference.

Questions:

1) Is there a way to get the handle of the different dialogs (not just controls) so I can try to set the background color /w the SetCtlColors instruction? I've tried doing a:

SetCtlColors 105 "" ffffff

but that doesn't work (I didn't expect it to).

2) Is there a way to staticaly define the background color of a dialog within the resource definition itself, or does it have to be done programmatically?

3) I've also seen a message (WM_) that the dialog can handle that sets it's background color, but don't understand how that would be used within the context of NSIS/MUI.

Any help on this would be greatly appreciated. This is the first post on the forum, and I hope I haven't asked something obvious. But per the rules, I have tried to read most of the posts on this subject. I'm not a GUI writer by trade and very well would be helped by a better understanding of resources and GUI programming.

Thanks in advance,
John


I know there's a define for MUI called 'MUI_BGCOLOR'. I haven't used it, but I know that it doesn't modify everything. Do you need something more than what this offers?


I'm afraid so.

The MUI_BGCOLOR is just for the Welcome and Finish pages. None of which I am using. There's also a MUI_LICENSEPAGE_BGCOLOR, but that's for the license text box, not the background color of the window.

Thanks anyway.


Have you tried setting callbacks functions for the dialogs that aren't displaying correctly and doing the SetCtlColors for the window handle of the currently displaying dialog? You'd have to do a FindWindow or something along those lines to get the window handle.


Yes and no. I've tried doing SetCtlColors calls from the .onGUIInit callback, but the issue is more getting the handle for the dialog and not an individual control. Are there individual callbacks for each dialog?


Use FindWindow to get the handle of the inner dialog. The example in the documentation does this.

Stu


So Stu,

You mean use:

FindWindow $MUI_TEMP1 "#32770" "" $HWNDPARENT
GetDlgItem $MUI_TEMP1 $MUI_TEMP1 ${CONTROL}
SetCtlColors $MUI_TEMP1 "" "${MUI_BGCOLOR}"

What identifies the inner dialog? Control 1018?


I have tried every combination of the FindWindow calls I can think of, but to no avail.

How does one get the handle of dialog 102 (defined within the modern.exe)?

I've also tried downloading the source and have modified the dialogProc() within the exehdr/ui.cpp to return a brush object set to RGB(255, 255, 255). But that hasn't worked either. Next I am going to try and modify the different LicenseProc(), InstFilesProc(), etc.?

Help,
John