Click to See Complete Forum and Search --> : How do i find the number of characters in a rich edit control?
December 9th, 1999, 04:42 PM
I'm using vb6 and the richedit 2.0 control. I want to be able to quickly get the number of characters in the control. (other than using len(textrtf) which is waaaay to slow) I know that there is a user defined message for the control (EM_GETTEXTLENGTHEX), that i found in msdn. This message takes a c structure as one of its parameters, i set all this up from the information in richedit.h but i don't think the data types are compatible. Has anyone used this message in vb before, or has another way to get this information?
Chizl
December 10th, 1999, 12:43 AM
This should work quickly..
iCount = len(replace(RichEditBox1.Text," ",""))
--
Chizl
chizl@NOSPAM.karland.com
http://www.chizl.com/
December 10th, 1999, 09:23 AM
I'm not trying to simply ignore spaces, in the end, i'm trying to find the number of bytes in the control. I cannot simply reference the text or textRTF properties of the control in visual basic, every time that happens, the computer pauses while it brings the variable into a vb string (this takes a long time if you have ole images in the rich text control)... so i need to use a message of some sort.
December 13th, 1999, 11:50 AM
nevermind... the vb ocx of the rich edit control is the 1.0 version of the rich edit control, which doesn't understand this message. I had to do a loadlibrary on the riched20.dll and do a CreateWindowEx to put the 2.0 control on the form. Now it understands the message, but now i lose the ease of the ocx typelib and have to do everything myself.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.