none
getting Interface IHTMLWindow6 from IWebBrowser2 RRS feed

  • Question

  • Hi,

    can anybody explain why the following code is incorrect:

      CComQIPtr<IDispatch, &IID_IDispatch> spDisp;
      HRESULT hr = _webBrowser->get_Document(&spDisp);
      CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spHTMLDoc;
      spHTMLDoc = spDisp;
      if (spHTMLDoc)
      {
        CComQIPtr<IHTMLWindow2, &IID_IHTMLWindow2> spHTMLWin2;
        HRESULT hr = spHTMLDoc->get_parentWindow(&spHTMLWin2);
        if(SUCCEEDED(hr))
        {
          CComQIPtr<IHTMLWindow6, &IID_IHTMLWindow6> spHTMLWin6 = spHTMLWin2;
          CComQIPtr<IHTMLStorage, &IID_IHTMLStorage> spHTMLStorage;
          HRESULT hr = spHTMLWin6->get_sessionStorage(&spHTMLStorage);

    It seems that the IHTMLWindow6 has not the correct Interface. The pointer "spHTMLWin6" is not NULL but the program hangs on the bolded line.

    Thanks

    Manfred

     

     


    • Moved by Yanping Wang Wednesday, March 30, 2011 8:10 AM ie extension issue (From:Internet Explorer Web Development)
    Saturday, March 26, 2011 5:43 AM

All replies

  • Further investigation but no success:

    I use VC2010. My solution was build against platform v10. After switching to sdk 7.1 the call to get_sessionStorage returns but with hr(s_false).

    I also checked that "session DOM storage" is checked on in the IE9 internet configuration option advanced dialog.

    Now I change the question to "How is it possible to create session storage from code?"

    Sunday, March 27, 2011 7:14 AM
  • Hi makalanus,

    This is a web developer forum which discuss about web development including HTML, CSS and Script. I am moving your thread to the "Internet Explorer Extension Development" which is more appropiate for your question.

    thanks for understanding!


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com
    Microsoft One Code Framework
    Wednesday, March 30, 2011 8:20 AM
  • Hi makalanus,

     

    I try above code using IE9 and VS2010, it works. The hr returned by spHTMLWin6->get_sessionStorage(&spHTMLStorage); is success.

     

    For geting and seting the session DOM storage, I believe your understanding correctly. We need obtain it by IHTMLWindow6::get_sessionStorage method, get / set the HTMLStorage object. 

     

    Cheers,

    Yi

     


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, March 30, 2011 9:37 AM
    Moderator
  • Hi,

     

    the problem was that I have called navigate and immeadialtely after this call get_sessionStorage.In this moment the navigate is not complete and therefore the error.

    Now I get HR success but "ACCESSDENIED". It seems now that it is not possible to call it outside of the domain. I navigate e.g. to google.com and after documentcomplete I try to save information in the storage.

    Can anybody explain how I can save information in the storage?

     


    Saturday, April 2, 2011 7:27 AM
  • Hi,

    Where can i find an example of that code for getting the data from the sessionStorage and how can i share it between multiple processes 

    that holds the web browser component ?

    Regards,

    Roy

    Tuesday, June 26, 2018 12:00 PM