You don't call that in your
default
case handler. You call it always, either at the top of your override code or at the bottom, depending on if you want the base default code to handle the message you're overriding or not. But, it either case, the base code must be called to handle all of the messages you're not handling.
THe code below will allow the base code to handle the CopyData message as well as letting your code handle it, adding to the functionality provided by the base code.
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
switch (m.Msg)
{
case Win32.WM_COPYDATA:
Win32.CopyDataStruct st = (Win32.CopyDataStruct)Marshal.PtrToStructure(m.LParam, typeof(Win32.CopyDataStruct));
string strData = Marshal.PtrToStringUni(st.lpData);
if (strData == "msgfromclientexe")
timer2.Enabled = true;
break;
}
}
This makes sure that the base code gets a crack at the message before you try to do anything with it.