상속: Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
예제 #1
0
        public WebBrowserEvents(WebBrowser browser)
        {
            if (browser.Document == null)
            {
                throw new InvalidOperationException("Can't add an event sink until the browser's document is non-null");
            }

            var serviceProvider = (IServiceProvider)browser.Document;
            var serviceGuid     = new Guid(SID.SWebBrowserApp);
            var iid             = new Guid(IID.ConnectionPointContainer);
            var cpc             = (IConnectionPointContainer)serviceProvider.QueryService(ref serviceGuid, ref iid);

            _sink   = new _EventSink(this);
            _cookie = new SafeConnectionPointCookie(cpc, _sink, new Guid(IID.WebBrowserEvents2));
        }
예제 #2
0
        public WebBrowserEvents(WebBrowser browser)
        {
            if (browser.Document == null)
            {
                throw new InvalidOperationException("Can't add an event sink until the browser's document is non-null");
            }

            var serviceProvider = (IServiceProvider)browser.Document;
            var serviceGuid = new Guid(SID.SWebBrowserApp);
            var iid = new Guid(IID.ConnectionPointContainer);
            var cpc = (IConnectionPointContainer)serviceProvider.QueryService(ref serviceGuid, ref iid);

            _sink = new _EventSink(this);
            _cookie = new SafeConnectionPointCookie(cpc, _sink, new Guid(IID.WebBrowserEvents2));
        }