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. CHtmlView - how to hide the scrollbar(s)?

CHtmlView - how to hide the scrollbar(s)?

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
7 Posts 4 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.
  • H Offline
    H Offline
    helsten2
    wrote on last edited by
    #1

    :confused: I am trying to hide the scrollbar(s) in a CHtmlView without success. I have tried the following: In PreCreateWindow: cs.style ^= WS_VSCROLL; In OnInitialUpdate: ModifyStyle(WS_VSCROLL,0); and ShowScrollBar(SB_VERT,false); and CScrollBar* pSB=AfxGetMainWnd()->GetScrollBarCtrl(SB_VERT); returns NULL as do CScrollBar* pSB=GetScrollBarCtrl(SB_VERT); What is the correct way of doing this? Thank you in advance!

    P K K 3 Replies Last reply
    0
    • H helsten2

      :confused: I am trying to hide the scrollbar(s) in a CHtmlView without success. I have tried the following: In PreCreateWindow: cs.style ^= WS_VSCROLL; In OnInitialUpdate: ModifyStyle(WS_VSCROLL,0); and ShowScrollBar(SB_VERT,false); and CScrollBar* pSB=AfxGetMainWnd()->GetScrollBarCtrl(SB_VERT); returns NULL as do CScrollBar* pSB=GetScrollBarCtrl(SB_VERT); What is the correct way of doing this? Thank you in advance!

      P Offline
      P Offline
      pba_
      wrote on last edited by
      #2

      As far as a know you cannot do that, because the scroll bar belongs to the WebBrowser control . For details about hosting MSHTML you should check for IDocHostUIHandler , IDocHostShowUI interfaces ( or something like that ) in Internet Dev. SDK

      1 Reply Last reply
      0
      • H helsten2

        :confused: I am trying to hide the scrollbar(s) in a CHtmlView without success. I have tried the following: In PreCreateWindow: cs.style ^= WS_VSCROLL; In OnInitialUpdate: ModifyStyle(WS_VSCROLL,0); and ShowScrollBar(SB_VERT,false); and CScrollBar* pSB=AfxGetMainWnd()->GetScrollBarCtrl(SB_VERT); returns NULL as do CScrollBar* pSB=GetScrollBarCtrl(SB_VERT); What is the correct way of doing this? Thank you in advance!

        K Offline
        K Offline
        Klaus Probst
        wrote on last edited by
        #3

        You need to get a pointer to the internal document of the view and set its scroll to 'no'. ___________ Klaus [www.vbbox.com]

        H 1 Reply Last reply
        0
        • K Klaus Probst

          You need to get a pointer to the internal document of the view and set its scroll to 'no'. ___________ Klaus [www.vbbox.com]

          H Offline
          H Offline
          helsten2
          wrote on last edited by
          #4

          Thank you for the answer. I still don't know how to get the pointer to the internal document and set its scroll. Could you present the lines of code necessary to do that?:|

          1 Reply Last reply
          0
          • H helsten2

            :confused: I am trying to hide the scrollbar(s) in a CHtmlView without success. I have tried the following: In PreCreateWindow: cs.style ^= WS_VSCROLL; In OnInitialUpdate: ModifyStyle(WS_VSCROLL,0); and ShowScrollBar(SB_VERT,false); and CScrollBar* pSB=AfxGetMainWnd()->GetScrollBarCtrl(SB_VERT); returns NULL as do CScrollBar* pSB=GetScrollBarCtrl(SB_VERT); What is the correct way of doing this? Thank you in advance!

            K Offline
            K Offline
            Kastellanos Nikos
            wrote on last edited by
            #5

            The Webbrowser control queries the application COleControlSite for an interface called XDocHostUIHandler. Get the 'driller' sample from msdn which implements this control. If it founds it, it calls the method GetHostInfo(DOCHOSTUIINFO* pInfo ); In there, you have to put the following code: pInfo->dwFlags = DOCHOSTUIFLAG_SCROLL_NO; XDocHostUIHandler is good for setting other properties of the control and also for disable or replacing the context menu of the browser. - - - - - - - - - - - - - - - - - - Memory leaks is the price we pay \0 01234567890123456789012345678901234

            H 1 Reply Last reply
            0
            • K Kastellanos Nikos

              The Webbrowser control queries the application COleControlSite for an interface called XDocHostUIHandler. Get the 'driller' sample from msdn which implements this control. If it founds it, it calls the method GetHostInfo(DOCHOSTUIINFO* pInfo ); In there, you have to put the following code: pInfo->dwFlags = DOCHOSTUIFLAG_SCROLL_NO; XDocHostUIHandler is good for setting other properties of the control and also for disable or replacing the context menu of the browser. - - - - - - - - - - - - - - - - - - Memory leaks is the price we pay \0 01234567890123456789012345678901234

              H Offline
              H Offline
              helsten2
              wrote on last edited by
              #6

              Thanks a lot. This solved my problem. I only had to orverride CHtmlView::OnGetHostInfo(). FYI, here is all the code I had to add: HRESULT CYourView::OnGetHostInfo(DOCHOSTUIINFO* pInfo) { pInfo->dwFlags = DOCHOSTUIFLAG_SCROLL_NO; // default indicates we don't have info return S_OK; }

              K 1 Reply Last reply
              0
              • H helsten2

                Thanks a lot. This solved my problem. I only had to orverride CHtmlView::OnGetHostInfo(). FYI, here is all the code I had to add: HRESULT CYourView::OnGetHostInfo(DOCHOSTUIINFO* pInfo) { pInfo->dwFlags = DOCHOSTUIFLAG_SCROLL_NO; // default indicates we don't have info return S_OK; }

                K Offline
                K Offline
                Kastellanos Nikos
                wrote on last edited by
                #7

                I didn't know that CHtmlView had that fuction. I was ready to use other way in an application, but this is much more simple. Thanks for mention it. - - - - - - - - - - - - - - - - - - Memory leaks is the price we pay \0

                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