public void Dispose()
 {
     if (cookie != -1)
     {
         connPoint.Unadvise(cookie);
     }
     cookie = -1;
     handler = null;
 }
 //------------------------------------------------------------
 public HTMLDocument2Events2Sink(int procId, IHTMLDocument2 doc, DocumentCompleteEventHandler h)
 {
     this.procId = procId;
     this.doc = doc;
     docCompletedHandler = h;
     handler = new Handler(this);
     connPointContainer = (IConnectionPointContainer)doc;
     connPointContainer.FindConnectionPoint(ref IID_HTMLDocumentEvents2, out connPoint);
     connPoint.Advise(handler, out cookie);
 }