I'm having a heck of a time figuring this out, the tutorials I found on the web are not complete or are for VB 6.0 (obsolete in some cases). On the C++ side I have the following ::
..... hwndExternalApplication = FindWindow(NULL, L"Dromocast Client"); SendMessage(hwndExternalApplication, WM_SETTEXT, NULL, (LPARAM)"Hello"); .....
"Dromocast Client" is my visual basic application, and I checked to make sure it's not NULL. In fact I get made sure I'm getting some data on the VB side. On my Visual Basic side I have the following ::
Protected Overrides Sub WndProc(ByRef m As Message)
Select Case (m.Msg)
Case WM_SETTEXT
Dim strTemp As String
strTemp = System.Runtime.InteropServices.Marshal.PtrToStringUni(m.LParam)
MessageBox.Show("GOT THE MESSAGE, SETTING LOCAL VARIABLE")
End Select
MyBase.WndProc(m)
End Sub
When I send the data over it's garbage, meaning strTemp comes out as all these chinese characters, and my title bar on the visual basic program gets garbled with a bunch of chinese characters as well. My guess is my "SendMessage" is written wrong, or I'm doing something silly, but I have no idea what. I'm not a windows programmer so I'm kinda trying to figure this stuff out by googling....any help would be greatly appreciated.