News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

append a line on richedit

Started by Farabi, November 30, 2007, 08:34:50 PM

Previous topic - Next topic

Farabi

How to add a text on rich edit without erasing existing text?
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

ossama

if you want to insert the text into the end of the text in the rich edit control do this:

..
..
chrg CHARRANGE<>
szNewText db "this is the new text to be inserted",0
..
..
;set the cursor in the end of the rich edit text
mov chrg.cpMin,-1
mov chrg.cpMax,0
invoke SendMessage,hRrichEdit,EM_EXSETSEL,0,addr chrg

;insert nex text
invoke SendMessage,hRrichEdit,EM_REPLACESEL,TRUE,addr szNewText


and if you want to replace any selection in the rich edit text do this:


invoke SendMessage,hRrichEdit,EM_REPLACESEL,TRUE,addr szNewText


and if you want to cancel any selection and insert the text in the currrent position of the cursor do the following :


..
..
mov eax,chrg.cpMax
mov chrg.cpMin,eax
invoke SendMessage,hRrichEdit,EM_EXSETSEL,0,addr chrg
;insert nex text
invoke SendMessage,hRrichEdit,EM_REPLACESEL,TRUE,addr szNewText
..
..

i hope this solve your problem

Farabi

Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"