Discussion:
Firing onkeypress event using IHTMLDocument4
(too old to reply)
a***@gmail.com
2009-04-14 06:33:06 UTC
Permalink
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
rob^_^
2009-04-15 02:26:38 UTC
Permalink
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/threads

Regards.
Post by a***@gmail.com
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?
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***@gmail.com
2009-04-15 06:16:35 UTC
Permalink
Post by rob^_^
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.
Post by a***@gmail.com
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?
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- Hide quoted text -
- Show quoted text -
Business case: regional language processing.

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

Thanks.

Loading...