public int CreateInstance(IntPtr pUnkOuter, ref Guid riid, out IntPtr ppvObject) { ppvObject = IntPtr.Zero; if (pUnkOuter != IntPtr.Zero) { Marshal.ThrowExceptionForHR(COMNative.CLASS_E_NOAGGREGATION); } if ((riid == new Guid(IpcClientServer.ClassId)) || (riid == new Guid(COMNative.IID_IDispatch)) || (riid == new Guid(COMNative.IID_IUnknown))) { if (instance == null) { instance = new IpcClientServer(); instance.Received += (s, e) => { this.server.OnReceived(e); }; } ppvObject = Marshal.GetComInterfaceForObject(instance, typeof(IIpcClientServer)); } else { Marshal.ThrowExceptionForHR(COMNative.E_NOINTERFACE); } return(COMNative.S_OK); }
public void Stop() { IpcClientServer.Unregister(this.cookie); }
public void Start() { this.cookie = IpcClientServer.Register(this); }