Example #1
0
        public IPCChannel(IWin32Window host, string ipcName = DEFAULTIPCNAME, int ipcId = DEFAULTIPCID)
        {
            _form  = host;
            _ipcId = ipcId;

            AssignHandle(host.Handle);

            var filterStatus = new User32.CHANGEFILTERSTRUCT();

            filterStatus.size = (uint)Marshal.SizeOf(filterStatus);
            filterStatus.info = 0;

            User32.ChangeWindowMessageFilterEx(host.Handle, User32.WM_COPYDATA, User32.ChangeWindowMessageFilterExAction.Allow, ref filterStatus);
            User32.SetProp(host.Handle, ipcName, new IntPtr(_ipcId));
        }