How to add a text on rich edit without erasing existing text?
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
Wow. thanks :U