WebBrowserComponent - Detecting termination (Windows)


I am opening a web page using a WebBrowserComponent, and that webpage has a button with onclick="window.close();"
Upon clicking on the button, I receive this messagebox:

After clicking yes, the WebBrowserComponent is no longer being drawn (paint() does nothing) and all I see in it’s place is a black void.
Is there any way of detecting this? I read the IWebBrowser2 API and it seems there’s this event called DWebBrowserEvents2::OnQuit(), but I have no experience in Win32API/ActiveX…


breakpoint in either,

bool pageAboutToLoad (const String& newURL) void pageFinishedLoading (const String& url)

to see what it’s doing after, maybe it’s trying to go to another page. Also, the browser is IE7 (which causes problems), so add in my special hack.

[code] void fixWindowsRegistry()

    // want to add a key of the form
    // <binaryname>.exe  DWORD  9999
    // 9999 indicates IE9 

    String keypath = "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION\\";

    // build the full path to the key
    String key = keypath + JUCEApplication::getInstance()->getApplicationName() + ".exe";

    // this is the value we want
    unsigned int correctValue = 9999;
    bool ok = false;

    // lets look for it anyway
    bool v = WindowsRegistry::valueExists(key);
    if (v)
        MemoryBlock data;
        unsigned int sz = WindowsRegistry::getBinaryValue(key, data);
        if (sz == 4)             // DWORD
            unsigned int val = *(unsigned int*)data.getData();
            if (val >= correctValue)
                ok = true;

    if (!ok)
        WindowsRegistry::setValue(key, correctValue);


horrible, yes i know :slight_smile:


Well, I did check these two methods, nada.

I’m going to check your hack now, horrible or not, I need this :slight_smile:
I’ll report back!

Edit: Checked it, nothing has changed; it acts just the same.


ok, well it was worth a try!

I guess you’ll have to delve into the implementation and hook some more activeX methods to find out what’s really going on.