News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

about using EM_SETBKGNDCOLOR message

Started by vega, June 16, 2007, 09:54:45 AM

Previous topic - Next topic

vega

I don't know it's correct meaning that explanations in API Help comments as follow,

--------------------------------------
The EM_SETBKGNDCOLOR message sets the background color for a rich edit control.

EM_SETBKGNDCOLOR 
wParam = (WPARAM) (BOOL) fUseSysColor;
lParam = (LPARAM) (COLORREF) clr;


Parameters:

fUseSysColor
Value specifying whether to use the system color.
If this parameter is nonzero, the background is set to the window background system color.
Otherwise, the background is set to the specified color.

clr
COLORREF structure specifying the color if fUseSysColor is zero.
--------------------------------------

in my test,
this case(none system Color change mode) is OK.(Color is changed)

   ;change current window's Background color to RED
   INVOKE SendMessage, hRichEdit, EM_SETBKGNDCOLOR, 0, 000000FFh         

but, this one(system Color change mode) is not OK, (not changed)

   ;change all opened window's backGround color
   INVOKE SendMessage, hRichEdit, EM_SETBKGNDCOLOR, 1, 000000FFh

What's Wrong?           

-asm.Student-







zooba

Quote from: vega on June 16, 2007, 09:54:45 AM
What's Wrong?

Don't know. You're meant to tell us that. Is the colour not changing? Or is it not the default system colour? Is it still setting it to red?

As far as I can tell, your code is fine.

Cheers,

Zooba :U

vega

Yes, Color is not changes to specified color in these cases.


  INVOKE SendMessage, hRichEdit, EM_SETBKGNDCOLOR, 1, 000000FFh

  or

  INVOKE SendMessage, hRichEdit, EM_SETBKGNDCOLOR, 1, ADDR BackGroundColorStruc 

  or

  INVOKE SendMessage, hRichEdit, EM_SETBKGNDCOLOR, 1, ADDR BackGroundColorStruc.rgbResult




ramguru

I've tested, and it worked! Usually window_background color is white so you may think nothing changed, try setting other color in "Properties->Appearance->Advanced->Window->color1"

vega

Quote from: ramguru on June 16, 2007, 12:40:45 PM
I've tested, and it worked! Usually window_background color is white so you may think nothing changed, try setting other color in "Properties->Appearance->Advanced->Window->color1"


Is this Api-help sentence
   " If this parameter is nonzero, the background is set to the window background system color. "
means
   " If this parameter is nonzero, the Current window's background is set to the window's Default background color, only. "   ?










ramguru

Sorry I don't get your point  :( (what you're trying to prove or ask)
...but I think
invoke SendMessage, hRichEdit, EM_SETBKGNDCOLOR, 1, ...
...is used to restore initial (what it was before any changes) background color of richedit control, that's all its purpose.

vega

Oh..yes, I see.
Just, I undertood this problem.
Thank you very much, ramguru.
Thank you!  :bg

vega

and then,
in this case, Is it possible to dispense with last parameter(lParam) ?

  " invoke SendMessage, hRichEdit, EM_SETBKGNDCOLOR, 1, lParam "

ramguru

I'm sure that as long first parameter is 1 second one can be whatever you like: 1, -1, 0, lParam, wParam

vega

Yes, I see.
I understood sufficiently.
Thanks a lots for your Good teaching..!
:U