Solved

How can hide Vert Scrollbar of CHtmlView?

Posted on 2006-11-06
14
1,186 Views
Last Modified: 2013-11-20
Hi all,

I have a problem that HtmlView control show a webpage, not need ScrollBar, but that Scrollbar is still there and is disabled.

I used ShowScrollBar(SB_VERT, FALSE);

but it is still displayed.
0
Comment
Question by:CongUan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
14 Comments
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17887005
CHtmlView having multiple windows/container embeded inside it...

Just put following code to hide scrollbar of CHtmlView

   IHTMLDocument2 *lpHtmlDocument = NULL;
   LPDISPATCH lpDispatch = NULL;
   lpDispatch = GetHtmlDocument();
   ASSERT(lpDispatch);

   lpDispatch->QueryInterface(IID_IHTMLDocument2, (void**)&lpHtmlDocument);
   ASSERT(lpHtmlDocument);

   lpDispatch->Release();

   CComQIPtr<IHTMLDocument2>piDoc(lpHtmlDocument);  //pointer html document
   CComPtr<IHTMLElement>piElem;    //pointer to element
   CComPtr<IHTMLBodyElement>piBody;  //pointer to bodyelement

   piDoc->get_body(&piElem);  
   piElem->QueryInterface(&piBody);
   piBody->put_scroll(CComBSTR(_T("no")));   //Hide


-MAHESH
0
 

Author Comment

by:CongUan
ID: 17887492
I still see a Vert scrollbar when it display a webpage successfully.
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17887517
have you tried above code ? or can you post some code that you have tried ??
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:CongUan
ID: 17887555
i tried above code.
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17887597
where you have include following code in CHtmlView derived class function ??
0
 

Author Comment

by:CongUan
ID: 17888144
I included above code in OnDocumentComplete of ChtmlView derived class.
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17888170
At my end on CHtmlView derived class its successfully hiding scrollbars in OnDocumentComplete event.
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17895661
I performed following test to ensure its working :

I downloaded following sample with src which use CHtmlView : http://www.codeproject.com/miscctrl/chtmlview_search.asp. In CHtmlView_SearchView.CPP
Edit any function CCHtmlView_SearchView::FindText() and copy paste above code at end of function. In search box typed something and pressed enter and Vert scrollbar vanished.

-MAHESH
0
 

Author Comment

by:CongUan
ID: 17904996
still not work. i put above code into a function and call it anytime.
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17905111
CongUan ,
 It will be better if you post code about how you put above code in function and called if from where.. to resolve this..

-MAHESH
0
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 250 total points
ID: 17905129
I tried to put in above code at last just after lpTxtRange->Release(); and it seems to work... have you tried with that ?

void CCHtmlView_SearchView::FindText(CString searchText, long lFlags /* =2 */, BOOL bNNF /* =FALSE  (for internal use)*/)
{
::CoInitialize(NULL);
   
    .......
    .......

     lpTxtRange->Release();
            
        MessageBox("Hiding Vertical Scrollbar.......");
     
        CComQIPtr<IHTMLDocument2>piDoc(lpHtmlDocument);
        CComPtr<IHTMLElement>piElem;
        CComPtr<IHTMLBodyElement>piBody;
        piDoc->get_body(&piElem);
        piElem->QueryInterface(&piBody);
        piBody->put_scroll(CComBSTR(_T("no")));  

-MAHESH
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question