Archive: Change Load Bar Colour


Change Load Bar Colour
Hello

How I change the colour of the Loading Bar in the Install Files page of an NSIS installer?


The following attempts to send the message PBM_SETBARCOLOR to the loading bar window but the colour of the load bar never changes?

!include MUI2.nsh
!include WinMessages.nsh

InstallDir "abc"
Name "def"
OutFile "def.exe"

!define MUI_PAGE_CUSTOMFUNCTION_SHOW InstFilesPageShow
!insertmacro MUI_PAGE_INSTFILES

!macro RefreshWindow HWND IDC
GetDlgItem $R0 ${HWND} ${IDC}
ShowWindow $R0 ${SW_HIDE}
ShowWindow $R0 ${SW_SHOW}
!macroend

Function InstFilesPageShow

SendMessage 1004 ${PBM_SETBARCOLOR} 0 "COLORREF(0,200,200)"
System::Call `user32::SendMessage(i R1, i ${PBM_SETBARCOLOR}, i 0, i COLORREF(0,0,0))`
#!insertmacro RefreshWindow $HWND 1004
#!insertmacro RefreshWindow $mui.InstallPage 1004
!insertmacro RefreshWindow $HWNDPARENT 1004

FunctionEnd

Section "Dummy"
DetailPrint "Test"
SectionEnd

COLORREF is a C macro. You cannot superimpose it in NSIS script and expect it to work. Try the macro on this page (RGB2BGR):
http://nsis.sourceforge.net/SetCtlColors_with_variables

Stu


Function InstFilesPageShow
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $1 $0 1004
System::Call UxTheme::SetWindowTheme(ir1,w"",w"")
SendMessage $1 ${PBM_SETBARCOLOR} 0 0xC8C800
FunctionEnd