0
votes

I'm programming on MFC framework, VS 2008. And I follow this article Customize WebBrowser Control to hide scrollbars in WebBrowser control. The strange thing is that it works well with many websites for example www.vnexpress.net or www.dantri.com, but not with Microsoft page www.microsoft.com, i.e. the web browser always displays the vertical scrollbar on the right when navigating www.microsoft.com regardless what I am doing.

I've been googling for a day but did not find the answer. Does anyone knows how this could happen and how to solve this issue?

Thank you so much for your help!

1

1 Answers

0
votes

I found the following from a contributor on CodeProject in the discussion section of Using the WebBrowser control,simplified:

You need to add the following code to the start of the OnDocumentComplete() event handler:

CComPtr pdispDoc;
_Browser->get_Document(&pdispDoc);

CComQIPtr piDoc(pdispDoc);
CComPtr piElem;
CComPtr piBody;

piDoc->get_body(&piElem); 

if(piElem)
{
    piElem->QueryInterface(&piBody); 
    piBody->put_scroll(CComBSTR(_T("no"))); //Hides scrollbars!
}