Skip to content
⌘ NSIS Forum Archive

A few questions about SetBkColor

19 posts

Joel#

A few questions about SetBkColor

1. What is the color format for SetBkColor?
2.
Sets a background color for a static control, edit control, button or a dialog
Can we use it to paint the hole dialog? 😁 how?

PS1: Already attempting to paint the edit box
for the dir. installation, and it's working 👍 .

PS2: I've been promoted as Major Dude 😁 😁
Joel#
Ok, thanks ... I can change the rest of the statics bgcolors
in the dialog, license, components, etc
to be the same of the $HWNDPARENT;
but the in startmenu dialog, how can we change the static labels and
buttons bgcolors?
kichik#
Those are buttons with the IDs 1034 for I Agree and 1035 I Disagree. They support color changes too.
Joel#
Ok, I almost done with
the "painting" 😁

But, who can I change the part with the labels

See screenshot

Attachments

kichik#
Look for FindWindow in System.nsh. It finds HWNDs inside the inner dialog and sets their texts. Use the same only with SetBkColor instead of SendMessage WM_SETTEXT.
Joel#
Not all the inner dialgos has it


Push ${MUI_TEMP1}

FindWindow ${MUI_TEMP1} "#32770" "" $HWNDPARENT
GetDlgItem ${MUI_TEMP1} ${MUI_TEMP1} ${CONTROL}
SendMessage ${MUI_TEMP1} ${WM_SETTEXT} 0 "STR:${TEXT}"

SetBkColor ${MUI_TEMP1} ${NsisColor} ; Nsiscolor is 0x009c9485

Pop ${MUI_TEMP1}
kichik#
Has what? HWNDs? Every window including buttons, text boxes, dialogs, Internet Explorer windows and even the desktop has a HWND.
kichik#
Did you set the color using SetBkColor? I have mentioned the IDs of the radio buttons in the above post. You can get the rest using resource hacker.
Joel#
Yes!
I almost done it 😁

But still some areas 🙁
kichik#
Don't forget to set the inner dialog's color. BTW, you can't change the background color of the branding text thanks to some "nice" Windows limitations.
Joel#
Ok, after hours my "touchie" hurts 😁
What's the ID for the inner dialog and where I should put it?
In ".onInit" or ".onGUIInit"
I'm trying this:

FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1044
SetBkColor $0 0x00FFFFFF
kichik#
The inner dialog is what you find using FindWindow. The first $0 in the above script of yours.
Afrow UK#
This sure looks nice!

What colour code would you be using by any chance, since if I use anything other than 0xFFFFFF (same as 0x00FFFFFF) then it goes black.

-Stuart
Joel#

!define NsisColor "0x009c9485"

!define MUI_CUSTOMFUNCTION_GUIINIT "PaintME"

Function "PaintME"
SetBkColor $HWNDPARENT ${NsisColor}
GetDlgItem $0 $HWNDPARENT 1 ;button
SetBkColor $0 ${NsisColor}
GetDlgItem $0 $HWNDPARENT 2 ;Button
SetBkColor $0 ${NsisColor}
GetDlgItem $0 $HWNDPARENT 3 ;Button
SetBkColor $0 ${NsisColor}
FunctionEnd
Did you manage to paint the hole installer?
Can we see some screenshots?