Valhalla Legends Forums Archive | Battle.net Bot Development | link color

AuthorMessageTime
Camel
anybody know how to set the color of links in an rtb using EM_AUTODETECTURL?
April 14, 2003, 8:46 PM
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
April 14, 2003, 11:04 PM
Etheran
Camel:
first off send the EM_SETCHARFORMAT message
[code]
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;
);
[/code]
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
April 14, 2003, 11:30 PM
Camel
eh?

[code]
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
[/code]
April 15, 2003, 2:19 AM
Etheran
should work.. does it?
April 15, 2003, 2:27 AM
Camel
nope, links are still black
April 15, 2003, 2:31 AM
Skywing
[quote author=Camel link=board=17;threadid=1068;start=0#msg7884 date=1050373868]
nope, links are still black
[/quote]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.
April 15, 2003, 12:35 PM
zorm
I also attempted this with no luck, anyone have any other ideas?
[code]
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);
[/code]
April 15, 2003, 11:15 PM
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.
April 16, 2003, 9:25 AM
haZe
[quote author=FyRe link=board=17;threadid=1068;start=0#msg7946 date=1050485125]
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.
[/quote]
The other two being regular and olive.
April 16, 2003, 10:08 AM
Camel
found it. "window text" in effects w/ windowblinds, i'm too lazy to figgure out what it is w/o :)
April 16, 2003, 8:24 PM
MesiaH
[quote author=FyRe link=board=17;threadid=1068;start=0#msg7946 date=1050485125]
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.
[/quote]

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...
April 17, 2003, 6:06 AM

Search