G
Guest
Hello,
I try a inter process communication with windows messages and WM_COPYDATA.
It should work for managed and unmanaged applications. The receiver of
WM_COPYDATA messages is a managed applications. For the sender the result
code of SendMessage is important.
In the managed receiver I use Microsoft.WindowsCE.Forms.MessageWindow. I
override the WndProc, to check for WM_COPYDATA. Then I set the msg.Result to
the desired value and call base.WndProc. But the sender always get 0 as
result of his SendMessage.
What's wrong? Does base.WndProc overwrite my msg.Result.
Here is a code snippet from my receiver.
protected override void WndProc(ref Message msg)
{
switch(msg.Msg)
{
case Const.WM_COPYDATA:
COPYDATASTRUCT st = (COPYDATASTRUCT)
Marshal.PtrToStructure(msg.LParam, typeof(COPYDATASTRUCT));
if (this.iCallback != null)
{
string data = Marshal.PtrToStringUni(st.lpData);
msg.Result = AnotherFunction(data);
}
break;
}
base.WndProc (ref msg);
}
Thanks in advance
Steffen
I try a inter process communication with windows messages and WM_COPYDATA.
It should work for managed and unmanaged applications. The receiver of
WM_COPYDATA messages is a managed applications. For the sender the result
code of SendMessage is important.
In the managed receiver I use Microsoft.WindowsCE.Forms.MessageWindow. I
override the WndProc, to check for WM_COPYDATA. Then I set the msg.Result to
the desired value and call base.WndProc. But the sender always get 0 as
result of his SendMessage.
What's wrong? Does base.WndProc overwrite my msg.Result.
Here is a code snippet from my receiver.
protected override void WndProc(ref Message msg)
{
switch(msg.Msg)
{
case Const.WM_COPYDATA:
COPYDATASTRUCT st = (COPYDATASTRUCT)
Marshal.PtrToStructure(msg.LParam, typeof(COPYDATASTRUCT));
if (this.iCallback != null)
{
string data = Marshal.PtrToStringUni(st.lpData);
msg.Result = AnotherFunction(data);
}
break;
}
base.WndProc (ref msg);
}
Thanks in advance
Steffen