When you need to detect and close a specific window, you can do using
AddAutomationEventHandler method in the namespace System.Windows.Automation.
- Set Hook
line 4, set identifier for window open event which want to detect.
line 7, set event handler
line 7, set event handler
- Set Event Handler
line 8, compare name of element with the name to find.
line 15, print the contents of the window
line 22, find the "No" button, it's name has a character "N".
line 24~25, push the button.
Comments
Post a Comment