I tried to use GetWindowTextW to get a group of unicode characters from a RichEdit control, and use SetWindowTextW to put the unicode string to another RichEdit control, but all I got is a question mark '?'.
I have also tried to use EM_STREAMIN and EM_STREAMOUT to achive the goal, but I still have no luck.
Can anybody tell me how to do that?
Thanks...
hi
this convert unicode string to text string
invoke WideCharToMultiByte,0,0,lpBuffer,-1,offset lpBuffer,lpBufferlen,0,0
ragdog
ragdog, thanks for reply.
I am a little confused here. Do you mean that I need to convert unicode string to text string from a RichEdit control, and then, convert the text string back to the unicode string on another RichEdit control? or convert unicode string to text string from a RichEdit control, and then, save the text string to another RichEdit control?
For example,
invoke GetWindowTextW, hWndRichEdit1, lpBuffe, lpBufferlen
invoke WideCharToMultiByte,0,0,lpBuffer,-1,offset lpBuffer,lpBufferlen,0,0
invoke MultiByteToWideChar,0,0,lpBuffer,-1,offset lpBuffer,lpBufferlen,0,0
invoke SetWindowTextW, hWndRichEdit2, lpBuffe
or
invoke GetWindowTextW, hWndRichEdit1, lpBuffe, lpBufferlen
invoke WideCharToMultiByte,0,0,lpBuffer,-1,offset lpBuffer,lpBufferlen,0,0
invoke SetWindowTextA, hWndRichEdit2, lpBuffe
Hello,
with a richedit you have to use EM_GETTEXTRANGE not getwindowtext
When you have defined the range of caracters you want (EM_LINEFROMCHAR), use it as follow
Quote
lea eax,buffer
mov plage.lpstrText,eax ;plage=TEXTRANGE structure
INVOKE SendMessage,Hrichedit,EM_GETTEXTRANGE,0,addr plage
Then you can change the content of the buffer as you want
Thanks, ToutEnMasm.
EM_GETTEXTRANGE works.
By the way, EM_STREAMIN/EM_STREAMOUT can loads or saves unicode content to/from a file if the flag SF_UNICODE is set.
Thank you for your help, ToutEnMasm and ragdog.
This topic is closed now.