Hi,
May I know how to insert string into edit control (eg Rich Edit)?
What I means is, the program open a text file an load the content into rich edit control and I want the program to insert some words or string (Not by typing) in the rich edit control, whether in the middle or others location in rich edit control (Not over write the content)
Which message should I sent to rich edit control?
invoke sendmessage, hREd, EM_????, ????, ????

Thanks.
Posted on 2003-10-27 08:19:11 by QS_Ong
The EM_GETSELTEXT message retrieves the currently selected text in a rich edit control.

EM_GETSELTEXT
wParam = 0;
lParam = (LPARAM) (LPSTR) lpBuf;


Parameters

lpBuf

Pointer to a buffer that receives the selected text. The calling application must ensure that the buffer is large enough to hold the selected text.



Return Values

Returns the number of characters copied, not including the terminating null character.
Posted on 2003-10-27 09:10:14 by roticv
Hi roticv,
Thanks a lot. How about to INSERT text/string from buffer to rich edit control? :)
buffer db "Today is Monday",0
invoke sendmessage,hREd,EM_?????, buffer, ??? :confused:

Thanks
Posted on 2003-10-27 09:43:39 by QS_Ong
Completely replace text in rich edit with text in buffer? If so, use WM_SETTEXT. I think it works, not too sure though, had not been using richedit for sometime.

Anyway, tell me you are using fasm, if you are using masm, your code is wrong.
Posted on 2003-10-27 10:05:28 by roticv
Hi roticv,

Completely replace text in rich edit with text in buffer? If so, use WM_SETTEXT. I think it works, not too sure though, had not been using richedit for sometime.

Anyway, tell me you are using fasm, if you are using masm, your code is wrong.

What I mean is INSERT some text from buffer to rich edit control or RAEdit control. Not completely replace it. Just INSERT SOME text, not replace, like we type in rich edit control.

Sorry, I'm not using fasm. I use Sphinx C--. There is no problem with syntax. I can convert it into Sphinx C--. I just need to know the EM_??? or WM_??? or REM_???(for RAEdit)

Regards.
Posted on 2003-10-27 17:18:39 by QS_Ong
roticv, no offence, but you should read what the guy asks for before posting an offtopic answer. I am sure you just want to help but its not point to have the greatest posts counter.

QS_Ong, AFAIK there is no msg that will do that for you, you need to do it manualy.
Idea:
1. copy whole text from control into buffer, and clear control
2. copy part of text before place you want to insert string into control
3. copy string you want to insert into control
4. copy the rest of the text from buffer into control
Posted on 2003-10-27 17:41:38 by Mikky
Use EM_SETSEL or EM_EXSETSEL to select the text you want to replace. (You can specify position and create a selection that contains no characters.) Then use EM_REPLACESEL to replace it.
Posted on 2003-10-27 18:07:38 by tenkey