Re: Selection disabled in Web Browser Control
- From: "Max" <please@newsgroup>
- Date: Thu, 9 Aug 2007 14:03:38 +0300
I found out that I can analise the active item and set or remove flag
accordingly.
For instance:
GetHostInfo(
/* [out][in] */ DOCHOSTUIINFO *pInfo)
{
SHDocVw::IWebBrowserPtr webBrowserPtr(m_lpUnknown);
IDispatchPtr dispatchPtr = webBrowserPtr->Document;
MSHTML::IHTMLDocument2Ptr document2Ptr(dispatchPtr);
if (pInfo)
{
if (_bstr_t(TEXT("input"))==document2Ptr->activeElement->tagName)
{//Allow selection
pInfo->dwFlags &=~DOCHOSTUIFLAG_DIALOG;
}
else
{//Disallow selection
pInfo->dwFlags |=DOCHOSTUIFLAG_DIALOG;
}
}
return S_OK;
}
m_lpUnknown is a class member that hold web browser control pointer. You
have if you are hosting web browser control.
"Max" <please@newsgroup> wrote in message
news:%23VjUGDn2HHA.536@xxxxxxxxxxxxxxxxxxxxxxx
I have found something that makes web browser control allow or disallow
selection.
It is IDocHostUIHandler::::GetHostInfo that I implement.
I used to return E_NOTIMPL and it caused mouse selection to be disabled.
Now I do the following.
GetHostInfo(
/* [out][in] */ DOCHOSTUIINFO *pInfo)
{
if (pInfo)
{
pInfo->dwFlags &=~DOCHOSTUIFLAG_DIALOG;
}
return S_OK;
}
It allows mouse selection in the web browser control in general, but it is
not exactly what I want. I would like mouse selection to be disabled
except text boxes. I want selection to be enabled in check boxes only. How
do I implement that? Check active element in GetHostInfo?
"Max" <please@newsgroup> wrote in message
news:OeqKneN2HHA.5380@xxxxxxxxxxxxxxxxxxxxxxx
I have web browser control hosted in my application.
(Actually it is not my application, it is mmc.exe, but I believe it does
not
matter.)
The mouse selection is disabled. Normally in IExplore if user would press
a
mouse button and move the mouse some part of the document will be
selected.
It does not happen in my web browser control and this is Ok with me. I
actually do not need this selection because it is a sort of user
interface.
The problem is that in text boxes (input type text) selection by mouse
does
not work either. Selection by keyboard works fine.
How can I manage selection behaviour from implementation of
IDocHostUIHandler DWebBrowserEvents and things like that.
.
- References:
- Prev by Date: Re: Selection disabled in Web Browser Control
- Next by Date: IWebBrowser2 focus problem
- Previous by thread: Re: Selection disabled in Web Browser Control
- Next by thread: Office 2007 Documents open read-only in Internet Explorer / Webfolders
- Index(es):