I am trying to send text to a textbox on another program (which is also mine)
I can get the hwnd of that Textbox reliably.
However I am confused as to the syntax to use in the SendMessage call.
There are a few variations 'out there', but I guess they boil down to these two -

SendMessage hWndTextBox, WM_SETTEXT, 0&, ByVal sMsg
SendMessage hWndTextBox, WM_SETTEXT, Len(sMsg), sMsg

Penagate in his posting
www.vbforums.com/showthread.php?t=336836
uses SendMessage hWndTextBox, WM_SETTEXT, 0&, ByVal CStr(txtMsg.Text)

In this posting
http://www.vbforums.com/showthread.php?t=354746
one of the approaches is suggested, and then the originator (who raised the question) mentions that he had to switch to the other approach to avoid an error

I would appreciate it if someone could tell me which is the correct approach to use.