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. COM
  3. Webbrowser repaint

Webbrowser repaint

Scheduled Pinned Locked Moved COM
5 Posts 3 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.
  • D Offline
    D Offline
    dooly
    wrote on last edited by
    #1

    I developing a webbrowser using CHtmlView. But this browser is not repaint properly. That is, i want to use CView::Invalidate() for browser repaint. But this function is not work. Anybody have sample code. Thanks in advance. dooly

    B E 2 Replies Last reply
    0
    • D dooly

      I developing a webbrowser using CHtmlView. But this browser is not repaint properly. That is, i want to use CView::Invalidate() for browser repaint. But this function is not work. Anybody have sample code. Thanks in advance. dooly

      B Offline
      B Offline
      Brian Hart
      wrote on last edited by
      #2

      To have the view repaint, call CHtmlView::Refresh(). CHtmlView doesn't behave like a normal MFC view because all it does is wrap the WebBrowser control.

      D 1 Reply Last reply
      0
      • D dooly

        I developing a webbrowser using CHtmlView. But this browser is not repaint properly. That is, i want to use CView::Invalidate() for browser repaint. But this function is not work. Anybody have sample code. Thanks in advance. dooly

        E Offline
        E Offline
        Erik Thompson
        wrote on last edited by
        #3

        You can use CHTMLView::GetHTMLDocument to get the dispatch pointer for the document. Then you can get the window for the document. If you use Spy++, you will see that this has a classname of "Internet Explorer_Server". The following code will get you the handle to the window so that you can call InvalidateRect and UpdateWindow on it. IOleWindow* pOleWindow = NULL; HWND hWnd = NULL; // pDispatch is the IDispatch pointer retrieved from GetHTMLDocument of CHTMLView. HRESULT hr = pDispatch->QueryInterface(IID_IOleWindow,(LPVOID*)&pOleWindow); if (SUCCEEDED(hr) && pOleWindow) { hr = pOleWindow->GetWindow(&hWnd); // Ouput the classname to the debugger for verification if (SUCCEEDED(hr)) { TCHAR szClassName[256]; GetClassName(hWnd, szClassName, 256); OutputDebugString(szClassName); OutputDebugString(TEXT("\n")); } pOleWindow->Release(); pOleWindow = NULL; } I hope this helps, -Erik Thompson

        D 1 Reply Last reply
        0
        • E Erik Thompson

          You can use CHTMLView::GetHTMLDocument to get the dispatch pointer for the document. Then you can get the window for the document. If you use Spy++, you will see that this has a classname of "Internet Explorer_Server". The following code will get you the handle to the window so that you can call InvalidateRect and UpdateWindow on it. IOleWindow* pOleWindow = NULL; HWND hWnd = NULL; // pDispatch is the IDispatch pointer retrieved from GetHTMLDocument of CHTMLView. HRESULT hr = pDispatch->QueryInterface(IID_IOleWindow,(LPVOID*)&pOleWindow); if (SUCCEEDED(hr) && pOleWindow) { hr = pOleWindow->GetWindow(&hWnd); // Ouput the classname to the debugger for verification if (SUCCEEDED(hr)) { TCHAR szClassName[256]; GetClassName(hWnd, szClassName, 256); OutputDebugString(szClassName); OutputDebugString(TEXT("\n")); } pOleWindow->Release(); pOleWindow = NULL; } I hope this helps, -Erik Thompson

          D Offline
          D Offline
          dooly
          wrote on last edited by
          #4

          Thank you for your reply.

          1 Reply Last reply
          0
          • B Brian Hart

            To have the view repaint, call CHtmlView::Refresh(). CHtmlView doesn't behave like a normal MFC view because all it does is wrap the WebBrowser control.

            D Offline
            D Offline
            dooly
            wrote on last edited by
            #5

            Thank you for your reply.

            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