// Connect to ActiveX event source void Connect() { if (ConnectionPoint == null) { ConnectionCount = 0; Guid g = new Guid("614E1495-1014-44F8-B350-5344C0770C1E"); ConnectionPointContainer.FindConnectionPoint(ref g, out ConnectionPoint); EventSinkHelper = new _IQTControlEvents_SinkHelper(); ConnectionPoint.Advise(EventSinkHelper, out EventSinkHelper.Cookie); } }
// 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); }