Re: BHO and HTMLDocument event sink
- From: Nirmal <nirmal.c@xxxxxxxxx>
- Date: Mon, 23 Jul 2007 10:55:58 -0700
Well , tried same stuff with having a dispath event passed by
IHTMLDocument2->put_onXXX functions , same thing happens !!!
Not sure whats going on
Apologies if this is not the correct group to ask this question.
I'm trying to comeup with a BHO which also listens to some keystrokes
with in few html pages. ( no frames)
So One of approaches i thought was to have my BHO acting as event sink
of DWebBrowserEvents2 and HTMLDocuments2
like:
class CHelloWorldBHO;
typedef IDispEventImpl<1, CHelloWorldBHO, &DIID_DWebBrowserEvents2,
&LIBID_SHDocVw, 1, 1> snk1;
typedef
IDispEventImpl<1,CHelloWorldBHO,&DIID_HTMLDocumentEvents2,&LIBID_HelloWorldLib,
0,0> snk2;
// CHelloWorldBHO
class ATL_NO_VTABLE CHelloWorldBHO :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CHelloWorldBHO, &CLSID_HelloWorldBHO>,
public IObjectWithSiteImpl<CHelloWorldBHO>,
public IDispatchImpl<IHelloWorldBHO, &IID_IHelloWorldBHO,
&LIBID_HelloWorldLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
snk1,snk2
The bad thing is that i'm not able to capture key code on KEYUP
event , I think i may be doing something bad here,it always returns
1011 or some value.
if (dispidMember == DISPID_HTMLDOCUMENTEVENTS_ONKEYUP){
if(pDispParams->rgvarg != NULL){
VARIANTARG v = pDispParams->rgvarg[0];
if (v.vt == VT_DISPATCH){
wchar_t* name_keyCode = L"keyCode";
CComPtr<IDispatch> kdisp = v.pdispVal;
if (kdisp != NULL){
if (S_OK == kdisp->GetIDsOfNames(IID_NULL, &name_keyCode, 1,
LOCALE_SYSTEM_DEFAULT, &dispid_keyCode)) {
//blah blah
}
}
}
}
}
Any ideas?
Thanks in advance
Nirmal
.
- References:
- BHO and HTMLDocument event sink
- From: Nirmal
- BHO and HTMLDocument event sink
- Prev by Date: BHO and HTMLDocument event sink
- Next by Date: Re: BHO and HTMLDocument event sink
- Previous by thread: BHO and HTMLDocument event sink
- Next by thread: Re: BHO and HTMLDocument event sink
- Index(es):