Why is this WM_COPYDATA code not working?

411 Views Asked by At

I need to pass a object of a class from one c# application to another (Same machine different folders).

Tried following....

public static void SendMessageWithData( IntPtr destHandle,  IntPtr srcHandle )
        {
            COPYDATASTRUCT cds = new COPYDATASTRUCT();
            cds.dwData = srcHandle;            
            IntPtr iPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(cds));
            Marshal.StructureToPtr(cds, iPtr, true);

            SendMessage(destHandle, WM_COPYDATA, IntPtr.Zero, iPtr);

            Marshal.FreeCoTaskMem(cds.lpData);
            Marshal.FreeCoTaskMem(iPtr);
        }
0

There are 0 best solutions below