public static int CallWndProc(int nCode, int wParam, IntPtr lParam) { var cwpStruct = Marshal.PtrToStructure <CWPStruct>(lParam); if (cwpStruct.message == WinMsgType.WM_COPYDATA) { var msgKind = cwpStruct.wParam; var copyData = Marshal.PtrToStructure <CopyDataStruct>(cwpStruct.lParam); CopyDataHandler(copyData); } return(WindowAPI.CallNextHookEx(_nextHook, nCode, wParam, lParam)); }