Archive: How to change the textcolor of richeidt in the lience page?


How to change the textcolor of richeidt in the lience page?
Code is here. the front of text can be changed. but the function "SetCtlColors" seems doesn't work. SendMessage also cannot. how can i change the lience text color?
Thanks a lot! :p
===code begin===========
!include "MUI.nsh"

Name "dummy"
OutFile "dummy.exe"
XPStyle on
ShowInstDetails show
InstallDir $EXEDIR

!define MUI_PAGE_CUSTOMFUNCTION_SHOW "DirShowProc"
!insertmacro MUI_PAGE_LICENSE "lience.txt"

Function "DirShowProc"
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1000
CreateFont $1 "Times New Roman" 23 0
SendMessage $0 ${WM_SETFONT} $1 0
SetCtlColors $0 0xBAB0A6 0x000000
FunctionEnd

Section
; void
SectionEnd
========code end==========


As the rich edit control allows text inside it to have multiple colours you have to use EM_SETCHARFORMAT.

Stu


Thanks :)
But as I replace "SetCtlColors..." with "SendMessage $0 ${EM_SETCHARFORMAT} ${SCF_ALL} 0", nsis compiler has two warnings:
unknown variable/constant "{SCF_ALL}" detected, ignoring (...)
unknown variable/constant "{EM_SETCHARFORMAT}" detected, ignoring (...)
If i forget to define header files?
the lParam parameter of the message EM_SETCHARFORMAT should point to a CHARFORMAT structure , how to send it in nsis?


You need to define those constants yourself as the actual values (search via Google). To allocate a CHARFORMAT, use the System plug-in.

Stu


To Afrow UK:
Successful! Thank you :)