Reputation: 343
Without resorting to PInvoke, is there a way in .net to find out what windows are open? This is slightly different than asking what applications are running in memory. For example, Firefox could be running, but could be more than one window. Basically, I just want to be privy to the same information that the taskbar (and alt-tab
?) is.
Also, once I have a reference to a window, is there any way to programatically give it focus?
Is there any way to do this with managed code?
Upvotes: 3
Views: 420
Reputation:
Check out this LGPL project. I know it can set foreground for a window. Otherwise aku is correct. It'll require most likely some pinvoke calls.
http://mwinapi.sourceforge.net/
If you need information on pinvoke use:
Upvotes: 1
Reputation: 11255
You could check out the new UI Automation stuff in .NET 3.5. It is supposed to mask a whole lot of the PInovke stuff and works with web and WPF applications.
I haven't used it yet, so I don't have a more specific place to direct you, but it might fit the bill.
Upvotes: 1