<p>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 <code>alt-tab</code>?) is.</p>

<p>Also, once I have a reference to a window, is there any way to programatically give it focus?</p>

<p>Is there any way to do this with managed code?</p>

[{'answer_id': 35866, 'author': 'aku', 'author_id': 1196, 'author_profile': 'https://Stackoverflow.com/users/1196', 'pm_score': 0, 'selected': False, 'text': '<p>I\'m afraid there is no way you can do it without PInvoke. To give focus to some window you should call SetForegroundWindow function, see <a href="http://www.codeproject.com/KB/cs/windowhider.aspx" rel="nofollow noreferrer">this</a> article for details.</p>\n'}, {'answer_id': 35936, 'author': 'Steven Murawski', 'author_id': 1233, 'author_profile': 'https://Stackoverflow.com/users/1233', 'pm_score': 1, 'selected': False, 'text': '<p>You could check out the new <a href="http://msdn.microsoft.com/en-us/library/ms747327.aspx" rel="nofollow noreferrer">UI Automation</a> stuff in .NET 3.5.  It is supposed to mask a whole lot of the PInovke stuff and works with web and WPF applications.</p>\n\n<p>I haven\'t used it yet, so I don\'t have a more specific place to direct you, but it might fit the bill.</p>\n'}, {'answer_id': 40139, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>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.</p>\n\n<p><a href="http://mwinapi.sourceforge.net/" rel="nofollow noreferrer">http://mwinapi.sourceforge.net/</a></p>\n\n<p>If you need information on pinvoke use: </p>\n\n<p><a href="http://www.pinvoke.net/" rel="nofollow noreferrer">http://www.pinvoke.net/</a></p>\n'}]
['https://Stackoverflow.com/questions/35834', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1493/']