RichEditCtrl used in chatting
Posted
by Dalsu-Jeon Dalsu-Jeon
on January 17th, 1999
I wanted an editbox that can be used in chatting.
Every chat message was inserted after the last message, user name and message
is distincted with another color and message has to have readonly attribute.
After all, If the message is full of the edit box, the view is autoscrolled upward.
To Use the CDalsuRichEdit...
- Copy "DalsuRichEdit.h", "DalsuRichEdit.cpp" in your work directory
- Add your project these two files
- Add a member data ex:m_pDalRich or m_pDalRich
- Create the CDalRichEdit's Window with suitable style
- AddName(CString &strName, COLORREF &crColor);
Specify the User Name and its color - AddText(CString &strTextIn, COLORREF &crColor);
Specify text string and its color
Don't forget! There are "\r\n" characters on the tail of this string. - AddMsg(CString &strMsg, COLORREF &crColor, BOOL bUnderLine, BOOL bBold);
It's general system message. ex:A User joined this room...
In the same manner, there are "\r\n" characters on the tail of this string.
Date Posted: 01/14/99

Comments
Solution: compatibility problem with Visual Studio.Net
Posted by Legacy on 04/08/2003 12:00amOriginally posted by: BBWicked
Hello,
beforehand please excuse my english and faults in my statements, because i normaly don�t talk english (i�m from germany) and i�m a beginner in programmming!
I noticed that the chat programm made faults, when running on a Visual Stuio.Net compiler(but not on a Visual Studio 6.0 compiler), it coloured letters he schouldn�t do!
I think the problem were the extensions of the "\n" at the strings which should be written into the richeditbox, because the function GetWindowTextLength couldn�t count them right.
The reason for it might be the handling of ANSI and UNICODE of this function (in VS.Net).
So my solution was to use the GetTextLengthEx function instead of the GetWindowTextLength function!
Here is a sample code:
int iTotalTextLength = GetTextLengthEx(GTL_DEFAULT,CP_ACP);
I Hope I could help anybody out there?!
greets
BBWicked
ReplySmall improvement to technique (also fixes bug)
Posted by Legacy on 03/12/2003 12:00amOriginally posted by: Andrew Newton
Reply혹시 한국사람 아니슈?
Posted by Legacy on 02/02/2003 12:00amOriginally posted by: 한국사람
컨트롤 이름이 달수RichEdit 이길래...
아무래도 한국사람같은데... 반갑소.
달수씨, 반가워요.
Reply
Event notifiaction for rich edit control
Posted by Legacy on 12/17/2002 12:00amOriginally posted by: pooja
ReplyMissing context menu when right clicking on the control !!!
Posted by Legacy on 11/24/2002 12:00amOriginally posted by: Michael Kuelshammer
I want to get the normal context menu for the CRichEditCtrl, with copy and paste and so on, any solution for it, how to get it ????
Thx,
Michael
ReplyI got AddText().. in Richedit2.0
Posted by Legacy on 07/10/2002 12:00amOriginally posted by: Rigmania
Replyhas trouble with UNICODE
Posted by Legacy on 06/07/2002 12:00amOriginally posted by: Tomas Bobovsky
I've created it as richeditctrl version 2 to work with unicode. Generally it does its job but the colors start to get out sync. I'm trying to fix it, if anyone has a solution, please email me.
ReplyChatBox ActiveX Control
Posted by Legacy on 02/20/2002 12:00amOriginally posted by: iBot
Goto http://ibot.hypermart.net
Replythanks very much
Posted by Legacy on 08/30/2001 12:00amOriginally posted by: yeong-hwi, lee
thanks
ReplyScrolling problem under win98
Posted by Legacy on 05/09/2001 12:00amOriginally posted by: Klymer
Well this is a really nice class
Replyonly one thing appears strange: the scrolling behaviour with win 98. Can you give me some hint how to fix that?
Loading, Please Wait ...