How to pass a string to an object outside of my app, if I have it's handle?
Printable View
How to pass a string to an object outside of my app, if I have it's handle?
What do you mean "pass a string." Give an example of what you want to do?
Like I have a textbox control and it's handle, and I want it to contain a custom string (exp. "Hello world"), that is what I mean by passing a string, but am not sure if this is possible, I mean to pass a complete string. If not I think it's possible to simulate a KeyDown method over that textbox, but I don't know how!
Try sending the WM_SETTEXT message.
Code:Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_SETTEXT = &HC
Private Sub Command1_Click()
SendMessage Text1.hwnd, WM_SETTEXT, 0, ByVal "My New Text"
End Sub