• Welcome to Valhalla Legends Archive.
 

link color

Started by Camel, April 14, 2003, 03:46 PM

Previous topic - Next topic

Camel

anybody know how to set the color of links in an rtb using EM_AUTODETECTURL?

ILurker

While your on this topic, Anyone know how to make the links clickable?, I mean like i can click on them, and the hand mouse icon appears, but nothing executes

Etheran

#2
Camel:
first off send the EM_SETCHARFORMAT message

lResult = SendMessage(      // returns LRESULT in lResult    
(HWND) hWndControl,      // handle to destination control    
(UINT) EM_SETCHARFORMAT,      // message ID    
(WPARAM) wParam,      // = (WPARAM) () wParam;    
(LPARAM) lParam      // = (LPARAM) () lParam;
);

specify the SCF_ALL bit for wParam and create a CHARFORMAT2 struct for lParam.  In your CHARFORMAT2 struct don't forget to set the CFE_LINK bit for dwEffects

More information at:
EM_SETCHARFORMAT:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/richedit/richeditcontrols/richeditcontrolreference/richeditstructures/charrange.asp

CHARFORMAT2 struct:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/richedit/richeditcontrols/richeditcontrolreference/richeditstructures/charformat2.asp

Camel

eh?


   Dim cf2 As CHARFORMAT2
   With cf2
       SendMessage txtChat.hwnd, EM_GETCHARFORMAT, SCF_ALL, cf2
       .dwEffects = .dwEffects Or CFE_LINK
       .crTextColor = vbWhite
       .crBackColor = vbRed
       .cbSize = Len(cf2)
       SendMessage txtChat.hwnd, EM_SETCHARFORMAT, SCF_ALL, cf2
   End With

Etheran

should work.. does it?

Camel

nope, links are still black

Skywing

#6
Quote from: Camel on April 14, 2003, 09:31 PM
nope, links are still black
Try removing the CFE_AUTOCOLOR effects bit.  A word of caution, however: IIRC, RichEdit gets the link colors from some user preference setting somewhere, so you should probably ask the user if it's OK to override what they have set for everything else.

Zorm

I also attempted this with no luck, anyone have any other ideas?

              CHARFORMAT2 cf;
   cf.cbSize = sizeof(CHARFORMAT2);
   SendMessage(chat,EM_GETCHARFORMAT,SCF_ALL,(LPARAM)&cf);
   cf.dwEffects = CFE_LINK;
   cf.dwMask = CFM_LINK | CFM_COLOR;
   cf.crTextColor = 0xFFFFFF;
   SendMessage(chat,EM_SETCHARFORMAT,SCF_ALL,(LPARAM)&cf);
"Now, gentlemen, let us do something today which the world make talk of hereafter."
- Admiral Lord Collingwood

FyRe

For an odd reason some Windows XP Themes change the color of the link.  I know the Silver theme does and the other two do not.

haZe

Quote from: FyRe on April 16, 2003, 04:25 AM
For an odd reason some Windows XP Themes change the color of the link.  I know the Silver theme does and the other two do not.
The other two being regular and olive.

Camel

found it. "window text" in effects w/ windowblinds, i'm too lazy to figgure out what it is w/o :)

Mesiah / haiseM

Quote from: FyRe on April 16, 2003, 04:25 AM
For an odd reason some Windows XP Themes change the color of the link.  I know the Silver theme does and the other two do not.

yes, but as skywing said, there is a default color some place you can set for all un-named richedit control's, thats why he warned about overriding it for other programs...
]HighBrow Innovations
Coming soon...

AIM Online Status: