Finding out if scrollbar is needed
- From: chris_prog <puffy_chris@xxxxxxxxx>
- Date: Mon, 10 Sep 2007 05:17:09 -0700
Hello Everyone!
In my webbrowser control, I don't want to show the default scrollbar,
but want to do some different stuff outside the browser when the
scrollbar would be needed (talking only about vertical scrollbar).
Hiding the scrollbar was easy, with DOCHOSTUIINFO structure and
DOCHOSTUIFLAG_SCROLL_NO flag.
Also I found some posts which helped me figure out what code to use to
know if scrollbar is needed. The result is fine (tells me the right
answer), but for some reason my browser paints differently (wrongly)
if this code is inserted. This is the first time I had to deal with
the webbrowser control, so please, could anyone check if the following
code is good?
CComPtr<IHTMLElement> pHTMLBody;
hr = pHTMLDoc2->get_body(&pHTMLBody);
if (SUCCEEDED(hr) && pHTMLBody) {
CComQIPtr<IHTMLElement2>pHTMLBody2(pHTMLBody);
if (pHTMLBody2) {
long lScrollH, lClientH;
m_bScrollNeeded =
SUCCEEDED(pHTMLBody2->get_scrollHeight(&lScrollH))
&& SUCCEEDED(pHTMLBody2->get_clientHeight(&lClientH))
&& (lScrollH > lClientH);
}
}
pHTMLDoc2 is a CComPtr<IHTMLDocument2> variable, and right before the
above call there's a successful pHTMLDoc2->write(pSafeArray); call.
(using dynamic HTML content described in Joan Murt's article:
http://www.codeproject.com/miscctrl/htmlctrlsample.asp )
I've tried to place the same code after pHTMLDoc2->close(); without
success (still paints wrongly).
Thank you in advance,
Chris
.
- Prev by Date: Re: customizing browser control menu in dialog based application
- Next by Date: Re: PassthruAPP - how to get cookies+post data?
- Previous by thread: Flash doesn't repaint when shown on web browser control
- Next by thread: Re: PassthruAPP - how to get cookies+post data?
- Index(es):
Relevant Pages
|
|