
Sending a message from VB-app to VC-app
--------------9BEE2FC75B12CF524A8A207B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
How can I send a user defined message containing text from a VB-app to a
VC-app?
My code is shown below, but I don't get the string over. It is just
empty. Any ideas ?
VB-app:
Global Const WM_USER = 1024
Global Const WM_USER_VBDATA = WM_USER + 63
Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal
hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As
String) As Long
Dim par As String
.
.
Private Sub cmdSend_Click()
Dim hWndLoc As Long
hWndLoc = FindWindow("Afx:400000:8:14de:0:3f37", 0)
par = "Test"
SendMessage hWndLoc, WM_USER_VBDATA, 0, par
End Sub
VC-app:
LRESULT CMyMainFrame::USERVbData(WPARAM wParam, LPARAM lparam)
{
char *str = (char *)lparam; // <<<<<The str becomes empty here
return (LRESULT) TRUE;
Quote:
}
--------------9BEE2FC75B12CF524A8A207B
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
How can I send a user defined message containing text from a VB-app to
a VC-app?
<BR>My code is shown below, but I don't get the string over. It is just
empty. Any ideas ?
<P><U>VB-app:</U>
<BR>Global Const WM_USER = 1024
<BR>Global Const WM_USER_VBDATA = WM_USER + 63
<BR>Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal
hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As
String) As Long
<BR>Dim par As String
<P>.
<BR>.
<BR>Private Sub cmdSend_Click()
<BR>
<BR> Dim hWndLoc As Long
<BR> hWndLoc = FindWindow("Afx:400000:8:14de:0:3f37",
0)
<BR> par = "Test"
<BR> SendMessage hWndLoc, WM_USER_VBDATA, 0, par
<BR>End Sub
<BR>
<P><U>VC-app:</U>
<BR>LRESULT CMyMainFrame::USERVbData(WPARAM wParam, LPARAM lparam)
<BR>{
<BR> char *str = (char *)lparam; //
<<<<<The str becomes empty here
<BR> return (LRESULT) TRUE;
<BR>}
<BR> </HTML>
--------------9BEE2FC75B12CF524A8A207B--