Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6671619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:24:35+00:00 2026-05-26T03:24:35+00:00

I have an IE BHO created over 3 years ago that uses IHTMLEventObj::put_keyCode function.

  • 0

I have an IE BHO created over 3 years ago that uses IHTMLEventObj::put_keyCode function. This function has worked as documented in IE6, IE7 and IE8. However, when testing with IE9 RC it no longer works as documented. The function is called the same way and the result is S_OK, but the key does not show up in the input field. The call is being made in the DISPID_HTMLELEMENTEVENTS2_ONKEYPRESS even of my Invoke() function.

I found someone with a similar problem: http://social.msdn.microsoft.com/Forums/is/ieextensiondevelopment/thread/abcbaffd-ed8a-45b8-840b-8ad8d7d10081, however for some reason I am not able to view the issue. I was able to view it using google cache: http://webcache.googleusercontent.com/search?q=cache:3OkEceoi6jwJ:social.msdn.microsoft.com/Forums/is/ieextensiondevelopment/thread/abcbaffd-ed8a-45b8-840b-8ad8d7d10081+put_keyCode+IE9&cd=1&hl=pt-BR&ct=clnk&gl=br&source=www.google.com.br.

Any help would be greatly appreciated this is a critical issue that needs to be addressed asap.

Thanks in advance.

UPDATE:
Here is some code, but wanted to stress, that this code works perfectly in IE6, IE7 and IE8. In IE9, it returns S_OK, but the key is not changed.

BOOL CToolBandObj::InvokeElementOnKeyPress (    DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags,
                                            DISPPARAMS* pDispParams, VARIANT* pvarResult,
                                            EXCEPINFO*  pExcepInfo,  UINT* puArgErr)
{

    CComPtr<IDispatch> spEventObj;
    spEventObj = pDispParams->rgvarg[0].pdispVal;
    CComPtr<IHTMLEventObj> pHtmlEvent; 
    HRESULT hr = spEventObj->QueryInterface(IID_IHTMLEventObj,(LPVOID*)&pHtmlEvent);

    if (SUCCEEDED(hr) && pHtmlEvent)
    {
        CComPtr<IHTMLElement>spElement;
        hr = pHtmlEvent->get_srcElement(&spElement);

        _bstr_t bstrTag;
        spElement->get_tagName(&bstrTag.GetBSTR());

        if (SUCCEEDED(hr) && spElement)
        {
            LONG lKeyCode = 0;
            pHtmlEvent->get_keyCode(&lKeyCode);


            pHtmlEvent->put_keyCode(lKeyCode);
            pvarResult->vt = VT_BOOL;
            pvarResult->boolVal = VARIANT_TRUE;
            return TRUE;
        }
    }
}

UPDATE 2

We have filed a MSDN Case, they have found the issue, and last we heard from them were going to fix it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:24:36+00:00Added an answer on May 26, 2026 at 3:24 am

    Finally after opening a case and many weeks, a fix was released: The IHTMLEventObj::put_keyCode function does not work in Internet Explorer 9 Standards mode.

    Thank you Microsoft!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a [ComRegisterFunction] that I am using to register a BHO Internet explorer
I have a IE BHO plugin that I only want to be enabled when
I have a sidebar(iframe) that has its own instance on each tab you open.
Have created simple Ajax enabled contact forms before that have around 12 fields -
I have an IE BHO that's in development in C#. It is supposed to
Have some dates in my local Oracle 11g database that are in this format:
I have an Internet Explorer BHO that can execute a script on the current
i have developed an internet explorer toolbar or BHO that i would like to
I have a BHO, which i can see it as enabled in Add On's
I have a single xml file and every new thread of the program (BHO)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.