CoCreateInstance returns STG_E_FILENOTFOUND (0x80030002)

0

This line of code worked fine before, but now it returns STG_E_FILENOTFOUND (0x80030002).

hr = CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER, IID_IWebBrowser2, (LPVOID*)&browser);

I haven't change any of my codes, I just run it as usual and got this error. I've also looked for the answer elsewhere but none of them solves this problem.

What possibly causes this? And how to fix it?

Here's the full code, "browser" is IWebBrowser2's variable.

HRESULT AUTHORIZATION::Initialize()
{
    if (browser)
        return ERROR_ALREADY_INITIALIZED;
    HRESULT hr = OleInitialize(NULL);
    if (!SUCCEEDED(hr))
        return hr;
    hr = CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER, IID_IWebBrowser2, (LPVOID*)&browser);
    if (!SUCCEEDED(hr))
    {
        OleUninitialize();
        return hr;
    }
    browser->put_RegisterAsBrowser(VARIANT_TRUE);
    browser->put_RegisterAsDropTarget(VARIANT_FALSE);
    browser->put_StatusBar(VARIANT_FALSE);
    browser->put_ToolBar(FALSE);
    browser->put_Resizable(VARIANT_FALSE);
    browser->put_Width(default_dlg_width);
    browser->put_Height(default_dlg_height);
    return hr;
}
c++
internet-explorer
visual-studio-2012
ole
asked on Stack Overflow Apr 2, 2014 by DJ Pop • edited Apr 2, 2014 by Kara

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0