No result code for SendMessage with WM_COPYDATA

Hello,
I've asked this question in MSDN forum, but without result. So I' want to ask somebody here, whats the problem with my code.

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));
string data = Marshal.PtrToStringUni(st.lpData);
msg.Result = AnotherFunction(data);
break;
}
base.WndProc (ref msg);
}

Thanks in advance
Steffen




Answer this question

No result code for SendMessage with WM_COPYDATA

  • ruper

    Hello
    the problem is solved.
    If I do not call base.WndProc for messages I handle in derived class
    WndProc, everything works.
    Steffen

  • No result code for SendMessage with WM_COPYDATA