Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Camel on April 14, 2003, 03:46 PM

Title: link color
Post by: Camel on April 14, 2003, 03:46 PM
anybody know how to set the color of links in an rtb using EM_AUTODETECTURL?
Title: Re:link color
Post by: ILurker on April 14, 2003, 06:04 PM
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
Title: Re:link color
Post by: Etheran on April 14, 2003, 06:30 PM
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
Title: Re:link color
Post by: Camel on April 14, 2003, 09:19 PM
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
Title: Re:link color
Post by: Etheran on April 14, 2003, 09:27 PM
should work.. does it?
Title: Re:link color
Post by: Camel on April 14, 2003, 09:31 PM
nope, links are still black
Title: Re:link color
Post by: Skywing on April 15, 2003, 07:35 AM
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.
Title: Re:link color
Post by: Zorm on April 15, 2003, 06:15 PM
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);
Title: Re:link color
Post by: 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.
Title: Re:link color
Post by: haZe on April 16, 2003, 05:08 AM
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.
Title: Re:link color
Post by: Camel on April 16, 2003, 03:24 PM
found it. "window text" in effects w/ windowblinds, i'm too lazy to figgure out what it is w/o :)
Title: Re:link color
Post by: Mesiah / haiseM on April 17, 2003, 01:06 AM
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...