🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#11327
From: Remy Lebeau (TeamB)
Date: Fri, 13 Feb 2004 04:06
56 lines
3283 bytes
"Martin C" <martinc@aol.com> wrote in message
news:402c41a3@newsgroups.borland.com...

> As far as I understand the white list should allow popup windows
> from certain sites the user select, so in other words if I selected
> www.popuptest.com as one of the sites in my white list then any
> popup window that will come from this site should be allowed,
> and that is why I though of getting the URL of the source ie
> window that generated the popup windows....please correct me
> if I am saying anything wrong.

That is not what you were suggesting earlier.  You made it sound like you
wanted to allow/prevent popups based on the URL that the popup itself is
trying to go to, not the URL of the page that is displaying the popup.

If you want to prevent the popup based on the URL that the popup is trying
to display, I just came up with the following piece of code that actually
closes the popup window itself:

    case DISPID_BEFORENAVIGATE2:
    {
        CComQIPtr<IWebBrowser2, &IID_IWebBrowser2> m_spWebBrowser2Tmp;
        m_spWebBrowser2Tmp = pDispParams->rgvarg[6].pdispVal;

        WideString wURLToCheck =
(WideString)TVariant(pDispParams->rgvarg[5].pvarVal);
        if( wURLToCheck is blocked )
       {
            *(pDispParams->rgvarg[0].pboolVal) = VARIANT_TRUE;

            WideString wCurrentURL;
            m_spWebBrowser2Tmp->get_LocationURL(&wCurrentURL);

            // if there is no current url yet then it must
            // be a new window so close it as well

            if( wCurrentURL.Length() == 0 )
            {
                // destroy the containing window manually otherwise
                // an empty taskbar button may be left behind
                long lWindow = NULL;
                m_spWebBrowser2Tmp->get_HWND(&lWindow);
                if( lWindow != 0 )
                    DestroyWindow(reinterpret_cast<HWND>(lWindow));

                // shutdown the browser control
                m_spWebBrowser2Tmp->Quit();
            }
        }

        break;
    }


Gambit
Technical Details
Message-ID: <402c4b6a$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!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> <402c33b0@newsgroups.borland.com> <402c3691$1@newsgroups.borland.com> <402c3c42$1@newsgroups.borland.com> <402c41a3@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 20:07: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> <402c33b0@newsgroups.borland.com> <402c3691$1@newsgroups.borland.com> <402c3c42$1@newsgroups.borland.com> <402c41a3@newsgroups.borland.com>
Subject: Re: Remy please help...BHO question...again
Date: Thu, 12 Feb 2004 20:06:09 -0800
Lines: 58
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: <402c4b6a$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1076644714 67.22.138.253 (12 Feb 2004 19:58:34 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail