Zzz – Rev 1
?pathlinks?
using System;
using System.Collections.Generic;
using System.Text;
namespace Zzz.Utilities
{
public static class Helpers
{
#region Public Methods
/// <summary> Find all windows that match the given filter </summary>
/// <param name="filter">
/// A delegate that returns true for windows
/// that should be returned and false for windows that should
/// not be returned
/// </param>
public static IEnumerable<IntPtr> FindWindows(Natives.EnumWindowsProc filter)
{
var windows = new List<IntPtr>();
Natives.EnumWindows(delegate(IntPtr wnd, IntPtr param)
{
if (filter(wnd, param))
{
// only add the windows that pass the filter
windows.Add(wnd);
}
// but return true here so that we iterate all windows
return true;
}, IntPtr.Zero);
return windows;
}
public static string GetWindowTitle(IntPtr hWnd)
{
var length = Natives.GetWindowTextLength(hWnd) + 1;
var title = new StringBuilder(length);
Natives.GetWindowText(hWnd, title, length);
return title.ToString();
}
#endregion
}
}
Generated by GNU Enscript 1.6.5.90.