c# - How to get and handle form changes in a different form that is accessible from Application.OpenForms? -
i'm using delegate poll current active command focused external form every few milliseconds, works badly.
the title of question confusing, not have application.openforms
. property exposes collection of open forms. if new form opened had not been opened, added collection. operating scheme allows 1 active window @ time on desktop, want notified when active window changes. polling work this, isn't solution.
you either need install a global hook (wh_cbt 1 want), or take advantage of winevents infrastructure (via setwineventhook function) intended accessibility tools. both of these provide notification when active window changes. of course, scope won't limited application testing. you'll notification when active window on desktop changes other window. filter downwards application care about.
i don't have time @ moment translate of required code c#/.net, can find somewhere online, 1 time know search for. additionally, winevents wrapped in system.windows.automation
namespace.
c# .net winforms
No comments:
Post a Comment