enumeration of windows on desktop in c# ?

  • Thread starter Thread starter aspirit
  • Start date Start date
A

aspirit

hello

Is it possible (and how) to enum all windows on desktop in c# ?
I need this to write a program which closes miscelanious windows
with various titles.
 
aspirit,



Hmm, I don't think you can do that without using PInvoke and calling API
methods. Only think you can do is using the Process class from the
Diagnostics namespace and get all processes in the system. From there you
can get their main window if one is present. You can close that window (and
possibly close the application, but I don't think you can enumerate all
windows.
 
Abubakar said:
Hi,
using pinvoke maybe the only way in which case you have to call
EnumWindows/EnumChildWindows api.
Ab.
http://joehacker.blogspot.com
aspirit,
Hmm, I don't think you can do that without using PInvoke and calling API
methods. Only think you can do is using the Process class from the
Diagnostics namespace and get all processes in the system. From there you
can get their main window if one is present. You can close that window (and
possibly close the application, but I don't think you can enumerate all
windows.

thanks both of you

aspirit
 
Back
Top