Firing onkeypress event using IHTMLDocument4

A

abhijit.divekar

Hi,

I am in a BHO written in C++ (IE7).

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 (get_keyCode) correctly returns 'x' , 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
 
A

abhijit.divekar

Hi,

I don't think so.... What possible business case is there for this
functionality? Auto-complete spell checker? Keylogger? Malware?

try the IE Extension Development forum -http://social.msdn.microsoft.com/Forums/en-US/ieextensiondevelopment/...

Regards.














- Show quoted text -

Business case: regional language processing.

I've already posted on the MSDN forum for IE plugin dev.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top