This is thanks to Chike:
To get the current typed text use the following:
- Code: Select all
'disable editing, may not be needed
Call EnableWindow(RichEdit20AHnd, 0)
'Copy Text that has been typed in if any
txt_len& = SendMessage(RichEdit20AHnd, WM_GETTEXTLENGTH, 0, 0)
If txt_len& > 0 Then ' don't need all this if user not typing
' save user selection / cursor position
Call SendMessage(RichEdit20AHnd, EM_GETSEL, ByVal VarPtr(start_pos&), ByVal VarPtr(end_pos&))
' select all text and cut
res = SendMessage(RichEdit20AHnd, EM_SETSEL, 0, ByVal txt_len&)
res = SendMessage(RichEdit20AHnd, WM_CUT, 0, 0)
End If
Insert your code to send text to pal room... May look like the following:
- Code: Select all
'Send Text to room
Call SendMessageByString(RichEdit20AHnd, WM_SETTEXT, 0&, Text1.Text)
Call SendMessage(RichEdit20AHnd, WM_KEYDOWN, 13, 0)
Then restore the user text with the following:
- Code: Select all
'Send any typing back to box
If txt_len& > 0 Then
' text box is empty, paste saved text
res& = SendMessage(RichEdit20AHnd, WM_PASTE, 0, 0)
' restore selection / cursor position
res& = SendMessage(RichEdit20AHnd, EM_SETSEL, start_pos&, ByVal end_pos&)
End If
'enable editing
Call EnableWindow(RichEdit20AHnd, 1)
Again Thank you Chike







