Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

event sink for OkKeyDown does not fire?

46 views
Skip to first unread message

schuetz

unread,
Jul 27, 2009, 2:29:01 PM7/27/09
to
Hi all,

I'd like to implement an event sink to handle when the user scrolls up/down
using the cursor up/donw key. I implemented an event sink for OnKeyUp ,
OnKeyDown and OnMouseDown and registered it with the web browser control. For
some reason only the OnMouseDown event fires, when I click in the html doc,
but when I use the cursor up or down keys my event sink does not get called.

Any idea, what I'm doing wrong?

Thanks,
Thomas


code below:

header:

class CDHTMLEventSink : public CCmdTarget
{
DECLARE_DYNCREATE(CDHTMLEventSink)

public:
CDHTMLEventSink();
virtual ~CDHTMLEventSink();
virtual void OnFinalRelease();
STDMETHOD(Invoke)(DISPID dispIdMember, REFIID, LCID, WORD, DISPPARAMS*
pDisp, VARIANT* test, EXCEPINFO *, UINT *);
void OnKeyDown( IHTMLEventObj *pEvtObj );
void OnKeyUp( IHTMLEventObj *pEvtObj );
void OnMouseDown( IHTMLEventObj *pEvtObj );

protected:
DECLARE_MESSAGE_MAP()
DECLARE_DISPATCH_MAP()
DECLARE_INTERFACE_MAP()
};


cpp:

BEGIN_DISPATCH_MAP( CDHTMLEventSink, CCmdTarget )
DISP_FUNCTION_ID( CDHTMLEventSink, "HTMLELEMENTEVENTS2_ONKEYDOWN",
DISPID_HTMLELEMENTEVENTS2_ONKEYDOWN, OnKeyDown, VT_EMPTY, VTS_DISPATCH )
DISP_FUNCTION_ID( CDHTMLEventSink, "HTMLELEMENTEVENTS2_ONMOUSEDOWN",
DISPID_HTMLELEMENTEVENTS2_ONMOUSEDOWN, OnMouseDown, VT_EMPTY, VTS_DISPATCH )
END_DISPATCH_MAP()

void CDHTMLEventSink::OnKeyDown(IHTMLEventObj * /*pEvtObj*/ )
{
OutputDebugString( L"CDHTMLEventSink::OnKeyDown\n" );
}

void CDHTMLEventSink::OnMouseDown( IHTMLEventObj * /*pEvtObj */ )
{
OutputDebugString( L"CDHTMLEventSink::OnMouseDown\n" );
}

0 new messages