// Disconnect from ActiveX event source void Disconnect() { System.Threading.Monitor.Enter(this); try { if (EventSinkHelper != null) ConnectionPoint.Unadvise(EventSinkHelper.Cookie); ConnectionPoint = null; EventSinkHelper = null; } catch { } System.Threading.Monitor.Exit(this); }
// Connect to ActiveX event source void Connect() { if (ConnectionPoint == null) { ConnectionCount = 0; Guid g = new Guid("CDAC14D2-8BE4-11D3-BB48-00A0C93CA73A"); ConnectionPointContainer.FindConnectionPoint(ref g, out ConnectionPoint); EventSinkHelper = new IWMPSliderCtrlEvents_SinkHelper(); ConnectionPoint.Advise(EventSinkHelper, out EventSinkHelper.Cookie); } }