CWebBrowser2 (웹브라우저) 컨트롤에서 스크롤바 없애기  윤덕근 / yunskorea  

#include <mshtml.h>

CWebBrowser2 m_ctlWebBrowser; 라고 되어 있을때....

Class Wizard에서...
웹브라우저 컨트롤의 Message중 DocumentComplete에 대한 멤버함수 추가 후, 아래와 같이 작성하면 됩니다.


void CWebDlg::OnDocumentCompleteBrowser(LPDISPATCH pDisp, VARIANT FAR* URL) 
{
IDispatch *pDisp2 = m_ctlWebBrowser.GetDocument();

CString strOption = _T("no" );   // yes no auto

if (pDisp2 != NULL)
{
IHTMLDocument2* pHTMLDocument2;
HRESULT hr;
hr = pDisp2->QueryInterface(IID_IHTMLDocument2, (void**)&pHTMLDocument2);

if (hr == S_OK)
{
IHTMLElement *pIElement;
hr = pHTMLDocument2->get_body(&pIElement);

IHTMLBodyElement *pIBodyElement;
hr = pIElement->QueryInterface(IID_IHTMLBodyElement, (void**)&pIBodyElement);

BSTR bstr;
bstr = strOption.AllocSysString();
pIBodyElement->put_scroll(bstr);
}
pDisp2->Release ();
}   
}

Posted by 모과이IT
,