I am developing an app in C++ that uses UIAutomation to receive notification of significant events related to user interaction. I have tried anevent handler by calling AddAutomationEventHandler to listened for window opened events, but I am having problems stopping the notification and cleaning up before exiting. If the user has launched certain applications, such as Firefox, the call to RemoveAutomationEventHandlerhangs. (Calling RemoveAllEventHandlers also hangs in this case.) Note that all calls to add or remove event handlers are done in the context of the same non-UI thread.
Note: I am seeing this behavior on Windows 7 and on Windows 8.
Any ideas on why this is happening or how to fix it? What makes the structure changed event different from all the others?
Window open/close events are implemented via the kernel WinEvent handlers; the structure change events involve the client app. Does your non-ui thread pump messages? UI Automation needs to pump messages to get cross-process communications working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With