MSAA Accessibility API


  • I have an external Keypad application (EXE) to input continuous array of individual characters into Mozilla Firefox browser child element.
    I will get the event EVENT_OBJECT_FOCUS only once when I do the selection of Child Element. I am interested in the EVENT_OBJECT_VALUECHANGE,EVENT_OBJECT_LOCATIonchange events to input subsequent characters .
    I have the following Queries
    1. Do I need to call API NotifyWinEvent from my DLL loaded into Mozilla firefox EXE with event (EVENT_OBJECT_VALUECHANGE) to get this event in my
    Client Keypad application ?
    If Yes what is the value of the other input arguments for the API NotifyWinEvent (values for IAccessible* for the selected Child element ,
    Child ID, Child Data etc ?)
    2. Can I use the event EVENT_OBJECT_LOCATIonchange to get the "focused" element in the Mozilla Web page. I am getting only the event
    EVENT_OBJECT_LOCATIonchange, after the event EVENT_OBJECT_FOCUS is fired in my Client Keypad application ?
    If you can provide some sample code , or a link to some sample code it will be very useful as I am a newbie to the Accessible APIs .
    Tuesday, July 26, 2011 1:05 PM

All replies

  • Hi,

    If you’re building a new feature, I’d recommend you use UI Automation rather than MSAA. (MSAA is now a legacy technology, and won’t have any improvements made to it in the future.) Also, I should say that I’m not familiar with Firefox, so I don’t what child ids might be involved.

    I assume it’s not possible to achieve what you need by calling SendInput() to simulate key input when focus is in the controls you’re interested in. Doing that has the disadvantage that it assumes focus doesn’t move just before you do the SendInput(), but it does mean that all events would get raised in response to the key input in the same way as if the physical keyboard was used.

    But if you do need to simulate certain winevents, I’d recommend using the AccEvent SDK tool. That tool can be used to see what MSAA or UIA events get raised by specific UI. So you could point that tool to the browser, and look at all events raised as you move focus and input text. By looking at all the data supplied with the events, (eg with the EVENT_OBJECT_VALUECHANGE), that might help in figuring out what data you’d need to supply if you do need to raise the events yourself.

    Using AccEvent, you can also see all the EVENT_OBJECT_LOCATIONCHANGE and EVENT_OBJECT_FOCUS events raised as you work in the browser. Watching for EVENT_OBJECT_LOCATIONCHANGE events with the OBJID_CARET can be a handy way to check for the caret moving. For example, if the caret moves from one place to another in the same window, you’ll get no focus change events because focus hasn’t moved between windows. But you will get the EVENT_OBJECT_LOCATIONCHANGE event. I put a code snippet related to tracking the caret up at

    So hopefully using AccEvent might help to show exactly what events are being generated by the browser during normal keyboard input. Though I would first check whether using SendInput() would be sufficient for your scenarios, as that could be more straightforward than having to simulate input in other ways and trying to generate exactly the same events as if the input had come from the physical keyboard.




    Tuesday, July 26, 2011 2:09 PM