List all desktop windows code example: [
^]
Perhaps off-topic, but, fyi: in a WinForm Application: you can use Application.OpenForms to get a list of all open Forms, including minimized Forms.
Code example:
private void button1_Click(object sender, EventArgs e)
{
int notMinimizedFormCnt = 0;
foreach (Form frm in Application.OpenForms)
{
if (frm == this) continue;
if (frm.WindowState != FormWindowState.Minimized) notMinimizedFormCnt++;
}
label1.Text = notMinimizedFormCnt.ToString();
}
Note that if you have called Hide() on a Form, it still shows up in the Application.OpenForms collection: it's WindowState property is not changed ! imho, WinForms should provide another value in the WindowState enum for a hidden Form.