CreateWindow - 窗口未在IE中显示

时间:2013-09-29 20:48:51

标签: c++ internet-explorer com bho

我正在编写C ++中的BHO,

基本上我要做的是打开一个窗口,但是没有显示,我认为它可能与我传递给它的HINSTANCE有关。这是我使用的代码,任何人都认识到这段代码中哪些不正确? 谢谢:))

IServiceProvider* pServiceProvider = NULL;
if (SUCCEEDED(m_pWebBrowser->QueryInterface(
                    IID_IServiceProvider, 
                    (void**)&pServiceProvider)))
{
    IOleWindow* pWindow = NULL;
    if (SUCCEEDED(pServiceProvider->QueryService(
                    SID_SShellBrowser, 
                    IID_IOleWindow,
                    (void**)&pWindow)))
    {
        HWND hwndBrowser = NULL;
        if (SUCCEEDED(pWindow->GetWindow(&hwndBrowser)))
        {
HWND g_hwndMain;


g_hwndMain =  CreateWindow(TEXT ("AnxJTest Class"),TEXT("My Window"),WS_POPUP | WS_VISIBLE,0, 0, 200, 300,NULL, NULL, (HINSTANCE)hwndBrowser, NULL);
ShowWindow(g_hwndMain, SW_SHOW);
        }

        pWindow->Release();
    }

    pServiceProvider->Release();
}

0 个答案:

没有答案