CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2013
    Posts
    17

    JSON undefined in my webbrowser container

    Hi all,
    I create an IWebBrowser2* object and attached it to new window.
    I create also a simple html page containing JScript alert(JSON) command.
    when i load the page from IE the page works fine.
    but when i load the page from my object i get JSON undefined.
    do i nead to set my object with some setting?

  2. #2
    Join Date
    Apr 2013
    Posts
    17

    Re: JSON undefined in my webbrowser container

    My code:

    ...
    ATL::CComPtr<IWebBrowser2> m_spWebBrowser;
    ATL::CAxWindow m_wndContainer;

    HWND hWnd = m_wndContainer.Create(NULL,
    CRect(0,0,1200,600),
    (LPCTSTR)0,
    WS_CAPTION|WS_THICKFRAME|WS_OVERLAPPED|WS_MINIMIZEBOX|WS_MAXIMIZEBOX);

    if (NULL == hWnd) {
    return false;
    }
    if (FAILED(m_spWebBrowser.CoCreateInstance(__uuidof(WebBrowser), NULL))) {
    m_wndContainer.DestroyWindow();
    return false;
    }

    // associate webbrowser control with container window
    if (FAILED(m_wndContainer.AttachControl((IUnknown*)m_spWebBrowser, NULL))) {
    m_spWebBrowser = NULL;
    m_wndContainer.DestroyWindow();
    return false;
    }
    ....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured