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

Firing onkeypress using IHTMLDocument4

23 views
Skip to first unread message

abhijit...@gmail.com

unread,
Apr 14, 2009, 2:36:35 AM4/14/09
to
Hi,

I am in a BHO written in C++.

Here's what I want to achieve: When the onkeypress event fires when I
press a key in an input html element, I want to "add" a new key to the
input field on the webpage. So lets say if I press "a", I should see
"ax" on the screen in the i/p elem, as "x" is the fixed key i want to
add.

I am using IHTMLDocument4's createEventObject and fireEvent methods to
fire a "onkeypress" event from within the handler of an (another)
"onkeypress" event. I am getting these onkeypress events on a text
input html element (i.e. a input test box on an html page). So I have
an IHTMLEventObj off which I am able to base the new event object I am
creating.

In the new event obj I just created I put the Keycode (pNewEvObj-
>put_keyCode((LONG)'x')), setting it to lets say the char "x". So I
want "x" to get added to the input element on the webpage.

In fact the event is also getting fired but I dont see my "x" in the
input element.

Any ideas?

Additional info:
1. When my onkeypress gets called with the new event I just fired,
getting the keycode (gett_keyCode) correctly returns 'x' to me, as
expected.
2. The original onkeypress's IHTMLEventObj's get_srcElement and my new
IHTMLEventObj's get_srcElement return different pointers. Shouldnt
they be the same?


Thanks!
AbDiv

0 new messages