What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » problem getting the bg color in a RichTextBox

problem getting the bg color in a RichTextBox
Author: Message:
Mithrandir
Junior Member
**

ColorNick's creator

Posts: 85
Reputation: 3
36 / Male / –
Joined: Mar 2004
O.P. problem getting the bg color in a RichTextBox
I'm programming in VB6 and using the following code to retrieve the background color of the selected text in a RichTextBox:
code:
Public Function GetTextBackColor(ByVal rtfBox As RichTextBox) As Long
    Dim tCF2 As CHARFORMAT2
    tCF2.dwMask = CFM_BACKCOLOR
    tCF2.cbSize = Len(tCF2)
    Call SendMessage(rtfBox.hWnd, EM_GETCHARFORMAT, ercSetFormatSelection, tCF2)
    GetTextBackColor = tCF2.crBackColor
End Function

It works well, but when the background is not set (in that case we commonly see a white one), it returns 0; and it also returns 0 for a black background. So how can I make the difference between the two?

Please help me!
ColorNick v2 for MsgPlus 3 only: Official thread - Site & FAQ - Download
08-18-2004 04:40 PM
Profile PM Web Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: problem getting the bg color in a RichTextBox
Zero would be for black yes, but in this case it appears to also be used for default... I admit this is confusing. Double-check the RichTextEdit documentation on MSDN for clarification.
[Image: spartaafk.png]
08-18-2004 09:53 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On