ID: Q192993
The information in this article applies to:
Microsoft Active Accessibility (MSAA) client applications should ignore events from invisible windows.
Invisible windows send messages before they are fully initialized and ready to expose their information to Microsoft Active Accessibility client applications. There is also a possibility of them becoming visible between the time when an event is sent to and received by an Microsoft Active Accessibility client application. These factors can cause the client application to misbehave and return incorrect information about the window. For this reason, events from invisible windows should be ignored.
One of the side effects of ignoring events from these windows is that you might see different events depending on whether the application is using an in-context hook or an out-of-context hook. If the application uses an in- context hook, it can safely ignore the events of an invisible window until it becomes visible. However, if the application uses an out-of-context hook, the client might see events that would be ignored by an in-context client, or the client might ignore events that would be seen by an in-context client.
For an out-of-context client application to see the same events as an in-context client, do the following:
1. Use an in-context hooking mechanism in the application.
2. The application should ignore events from invisible windows.
3. Send other events to an out-of-context client using an IPC mechanism. An
example of this mechanism is the safe queue used by the Accessible Event
Watcher sample in the Microsoft Active Accessibility SDK.
Another problem that occurs when you ignore events from invisible windows
is that focus events might also be ignored. Take the MessageBox() type
popup windows, for example, like those used by Windows Explorer to display
the "Are you sure you want to delete this file?" messages. The focus event
from the "Yes" button on this window is ignored as a result of ignoring
focus events from invisible windows.
There are two options to work around this situation:
1. Defer the handling of the event until an OBJECT_SHOW event for the same
object is later received. Please note that if another focus event is
received in the meantime, the original focus event can be ignored.
2. Handle the focus events from invisible window differently. For example,
the Windows APIs could be used instead of using IAccessible. This might
or might not be possible depending on the kind of handling that is
needed.
For additional information, please see the Microsoft Active Accessibility Web at the following location:
http://www.microsoft.com/enable
Additional query words:
Keywords : kbAAcc kbClient kbHook
Issue type : kbinfo
Last Reviewed: October 21, 1998