owsProc(EvalWindow);
//Enumerate all Windows
EnumWindows(ewp, 0);
}
//EnumWindows CALLBACK function
private bool EvalWindow(int hWnd, int lParam)
{
if (m_invisible == false && !IsWindowVisible(hWnd))
return(true);
StringBuilder title = new StringBuilder(256);
StringBuilder module = new StringBuilder(256);
GetWindowModuleFileName(hWnd, module, 256);
GetWindowText(hWnd, title, 256);
if (m_notitle == false && title.Length == 0)
return(true);
wndArray.Add(new Window(title.ToString(), (IntPtr)hWnd,
module.ToString()));
return(true);
}
//implement IEnumerable
public IEnumerator GetEnumerator()
{
return (IEnumerator)this;
}
//implement IEnumerator
public bool MoveNext()
{
m_Position++;
if (m_Position < wndArray.Count)
{
return true;
}
else
{
return false;
}
}
public void Reset()
{
m_Position = -1;
}
public object Current
{
get
{
return wndArray[m_Position];
}
}
}
}