🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11472

Re: Remy please help...BHO question...again

#11472
From: Remy Lebeau (TeamB)
Date: Fri, 13 Feb 2004 02:24
33 lines
2276 bytes
"Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> wrote in message
news:402c26b0$1@newsgroups.borland.com...

> Basically, you would have to make DISPID_NEWWINDOW2
> create a temporary web browser instance on a hidden window
> of its own and allow the navigation normally, and then catch
> DISPID_BEFORENAVIGATE2 from the second browser
> instance and cancel the navigation from there.

I just found a cleaner solution that works in my BHO, at least:

    case DISPID_NEWWINDOW2:
        //...
        if( popup should be blocked )
        {
            IDispatch *pDisp = m_spWebBrowser2;
            *(pDispParams->rgvarg[0].ppdispVal) = pDisp;
            pDisp->AddRef();
        }
        break;

Where m_spWebBrowser2 is the IWebBrowser2 interface that the BHO receives
from IObjectWithSite::SetSite() during initialization.  It would seem that
when a new window uses the existing window's web browser instance, the
navigation is aborted altogether, including the creation of the new window.
I don't even get DISPID_BEFORENAVIGATE2 triggered at all.

Of course, this solution doesn't help you with your white-list feature, but
it does help my BHO since it does full-time blocking regardless of site.


Gambit
Technical Details
Message-ID: <402c33b0@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <402c0c73$1@newsgroups.borland.com> <402c1587$1@newsgroups.borland.com> <402c193c@newsgroups.borland.com> <402c26b0$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,d7cd5f398672172c
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-02-12 18:39:52 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <402c0c73$1@newsgroups.borland.com> <402c1587$1@newsgroups.borland.com> <402c193c@newsgroups.borland.com> <402c26b0$1@newsgroups.borland.com>
Subject: Re: Remy please help...BHO question...again
Date: Thu, 12 Feb 2004 18:24:28 -0800
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.22.138.253
Message-ID: <402c33b0@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1076638640 67.22.138.253 (12 Feb 2004 18:17:20 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail