I've a trouble to grab the text from a multiline editbox.

Basically, I use the following command to get it :

LongText db 1024 dup(?)
; selectionne le contenu de l'edit box
invoke SendMessage,IDC_EDT4,EM_SETSEL,0,-1
; copie le contenu de l'editbox
invoke SendMessage,IDC_EDT4,EM_GETSELTEXT,0,addr LongText

But i can't get anything in my buffer. Is EM_GETSELTEXT valid for a multiline editbox ? I though
it was, but I didn't found confirmation of this on msdn. Shall I better do that from a RichEdit control
or did I missed something ?

I ran it through Olly, the message EM_SETSEL seem to work fine, Olly didn't recognize EM_GETSELTEXT
(he send 43E as message), but appart that the function return 0 caracters copied. Have also trying
WM_GETTEXT without result......

Posted on 2004-06-24 03:25:29 by etherlord
Hi etherlord

Seem like you are using the ID not the controls handle.

To get the handle use GetDlgItem.

invoke GetDlgItem,hWnd,IDC_EDT4
invoke SendMessage,eax,EM_SETSEL,0,-1

Or you can use SendDlgItemMessage instead.

Posted on 2004-06-24 04:11:09 by KetilO
Yeah, you are right, I was not using the handle.

Currently this does not make it work better, so I think I'll have to
make a single app that does just that to see where I've missed

Thanks for your help

Posted on 2004-06-25 01:40:17 by etherlord

Invoke SendDlgItemMessage, hWnd, IDC_EDT4, EM_SETSEL, 0, -1
Invoke SendDlgItemMessage, hWnd, IDC_EDT4, EM_GETSELTEXT, 0, ADDR LongText

is more on what you are looking for, but I prefer:

Invoke GetDlgItemText, hWnd, IDC_EDT4, ADDR LongText, SIZEOF LongText

But to each their own :)

Bryant Keller (aka Synfire)
Posted on 2004-06-25 02:45:06 by Synfire
Hi etherlord

EM_GETSELTEXT might only work with richedit. If you want all the text in the editcontrol then Synfire has the solution.

Posted on 2004-06-25 04:27:06 by KetilO
Thanks for the help you two, Synfire prefered solution work perfectly ;)

Posted on 2004-07-02 02:11:32 by etherlord