Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Can I set timeout in IWebBrowser2 Navigate?

Can I set timeout in IWebBrowser2 Navigate?

Scheduled Pinned Locked Moved C / C++ / MFC
sysadminquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kobelakers76
    wrote on last edited by
    #1

    Due to poor network connection, sometimes the page does not fully load when I call Navigate. My code performs certain task after the entire page has done loading. Does anyone know if there is a default timeout for Navigate? If not, is there an elegant way to wait for a while before I call Navigate again? I could create a thread to monitor if my OnDocumentComplete function has been called but I am hoping for another way.

    K 1 Reply Last reply
    0
    • K kobelakers76

      Due to poor network connection, sometimes the page does not fully load when I call Navigate. My code performs certain task after the entire page has done loading. Does anyone know if there is a default timeout for Navigate? If not, is there an elegant way to wait for a while before I call Navigate again? I could create a thread to monitor if my OnDocumentComplete function has been called but I am hoping for another way.

      K Offline
      K Offline
      kobelakers76
      wrote on last edited by
      #2

      I am answering my own post but I don't think starting a thread and checking to see whether the page has done loading periodically will work because the Navigate call is single-threaded.

      S 1 Reply Last reply
      0
      • K kobelakers76

        I am answering my own post but I don't think starting a thread and checking to see whether the page has done loading periodically will work because the Navigate call is single-threaded.

        S Offline
        S Offline
        Sandeep Saini SRE
        wrote on last edited by
        #3

        Try this

        BOOL m_bReady = 0;
        BSTR bsStatus;
        CString str;

        m_pBrowser->Navigate2(vaURL,null,null,null,null) ;

        while(!m_bReady)
        {
        m_pBrowser->get_StatusText(&bsStatus);
        mStr = bsStatus;
        if(mStr == "Done") m_bReady=1;
        }

        K 1 Reply Last reply
        0
        • S Sandeep Saini SRE

          Try this

          BOOL m_bReady = 0;
          BSTR bsStatus;
          CString str;

          m_pBrowser->Navigate2(vaURL,null,null,null,null) ;

          while(!m_bReady)
          {
          m_pBrowser->get_StatusText(&bsStatus);
          mStr = bsStatus;
          if(mStr == "Done") m_bReady=1;
          }

          K Offline
          K Offline
          kobelakers76
          wrote on last edited by
          #4

          Thanks for the reply. But as I was trying to say with my second post, the browser functions are single-threaded so the while-loop will go into an infinite loop since Navigate2 won't get a chance to run. As far as I know, the only way to check if the page has finished loading or not is to write a call-back function.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups