what i'm trying to do is go pass a structure to different application usin WM_COPYDATA and sendmessage... may be the problem lies in marshalling .. please have a look and help me....... solve the error.. i'm not able to recv data using wm_copydata by RPC vb.net sending :: passing message to different application... Code: Dim data As CopyData Dim message As String = "this is to be sent" Dim obj As struct obj.s = "trialDAMN" data.lpData = Marshal.AllocHGlobal(Marshal.SizeOf(obj)) data.dwData = obj Marshal.StructureToPtr(obj, data.lpData, True) data.cbData = Marshal.SizeOf(obj) data.lpData = Marshal.StringToHGlobalAuto(message) Dim hwndTarget As IntPtr Dim MessageId As IntPtr hwndTarget = Me.GET_HANDLE_TWO MessageId = ONE_TO_TWO_MESSAGEID() ' send the data SendMessage(hwndTarget, WM_COPYDATA, Me.Handle, data) --------------- receiving and handling message and data.... using wndproc( dfsdfasdf ) Code: Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Select Case m.Msg Case WM_COPYDATA Dim data As CopyData Dim message As String Dim obj As struct obj = CType(m.GetLParam(GetType(CopyData)), CopyData).dwData MsgBox("lets c--" & obj.s) data = CType(m.GetLParam(GetType(CopyData)), CopyData) MsgBox("size of --- " & Marshal.SizeOf(data).ToString) obj = CType(m.GetLParam(GetType(struct)), struct) obj = Marshal.PtrToStructure(CType(m.GetLParam(GetType(CopyData)), CopyData).lpData, GetType(struct)) MsgBox("object's data is --- " & obj.s) MsgBox("Dwdata contents are : " & data.dwData.s.ToString) obj = data.dwData ' CType(data.dwData, struct) MsgBox("Object's data obtained 2nd method -- " & obj.s)