FiREFLi Posted May 31, 2007 Share Posted May 31, 2007 How can I get a list of all the windows open using c# on xp? Link to comment Share on other sites More sharing options...
0 jackslade Posted May 31, 2007 Share Posted May 31, 2007 Just to point you in the right direction, I believe you have to use the win api to get the list of open windows. Take a look at EnumWindows in the user32.dll Link to comment Share on other sites More sharing options...
0 FiREFLi Posted May 31, 2007 Author Share Posted May 31, 2007 I'm very new to C# and I'm using VS2005 to develop in which is also new to me. How exactly do I look at EnumWindow in user32.dll. Specifically, how to I look in any dll? Link to comment Share on other sites More sharing options...
0 jackslade Posted May 31, 2007 Share Posted May 31, 2007 this is a decent place to start for looking at all the winapi functions: Windows API Reference Looking at dlls is a different story. I am not that experienced with it, though a tool like dependency walker can help you see some of the functions. Really the main information you need is in the windows api. All that code is given in C++ and you will have to import the dll and delcare the function in C#, which may be a little advanced for you right now if you are just starting in C#. There are plenty of examples online though, just do some searching. Link to comment Share on other sites More sharing options...
0 James Rose Posted May 31, 2007 Share Posted May 31, 2007 Along these lines, can anyone tell me if there is a way in C# of VB.NET to capture when a window (for any and all apps) opens and closes. I would rather not run a process ever second (or 5, or 10 etc) to see what windows are "now" open and compare. Thanks Link to comment Share on other sites More sharing options...
0 The2 Posted May 31, 2007 Share Posted May 31, 2007 You can monitor windows messages, there's a message called WM_CREATE or something, and destroy... google it some more Link to comment Share on other sites More sharing options...
0 Doli Posted June 3, 2007 Share Posted June 3, 2007 I'm very new to C# and I'm using VS2005 to develop in which is also new to me. How exactly do I look at EnumWindow in user32.dll. Specifically, how to I look in any dll? http://pinvoke.net/default.aspx/user32.EnumDesktopWindows There is an example of using user.dll's EnumWindow in C# to list all open windows. Link to comment Share on other sites More sharing options...
0 chrismaddern Posted June 3, 2007 Share Posted June 3, 2007 Nice link :D Thanks, Yeah, it's much better to moniter the window events than run a service. Chris Link to comment Share on other sites More sharing options...
0 MaceX Posted June 3, 2007 Share Posted June 3, 2007 Yeh, you have to use the interop because there is no managed function in the library to accomplish this. Link to comment Share on other sites More sharing options...
Question
FiREFLi
How can I get a list of all the windows open using c# on xp?
Link to comment
Share on other sites
8 answers to this question
Recommended Posts