internal static IEnumerable <IntPtr> GetDesktopWindows() { IList <IntPtr> result = new List <IntPtr>(); WindowEnumProc callback = new WindowEnumProc((hwnd, lparam) => { result.Add(hwnd); return(true); }); EnumWindows(callback, IntPtr.Zero); return(result); }
private static IntPtr[] FindWindows(IntPtr parentWnd, string title, string className) { var data = new SearchData() { ClassName = className, Title = title }; var callbackProc = new WindowEnumProc(EnumChildWindowsCallback); EnumChildWindows(parentWnd, callbackProc, ref data); return(data.Results.ToArray()); }
public static List <IntPtr> GetAllChildHandles(IntPtr mainHandle) { List <IntPtr> childHandles = new List <IntPtr>(); GCHandle gcChildhandlesList = GCHandle.Alloc(childHandles); IntPtr pointerChildHandlesList = GCHandle.ToIntPtr(gcChildhandlesList); try { WindowEnumProc childProc = new WindowEnumProc(EnumWindow); EnumChildWindows(mainHandle, childProc, pointerChildHandlesList); } finally { gcChildhandlesList.Free(); } return(childHandles); }
private static extern bool EnumChildWindows(IntPtr hWnd, WindowEnumProc func, IntPtr lParam);
static extern bool EnumWindows(WindowEnumProc lpEnumFunc, IntPtr lParam);
internal static extern bool EnumChildWindows(IntPtr hwnd, WindowEnumProc func, IntPtr lParam);
[DllImport("user32.dll")] public static extern bool EnumThreadWindows (int threadId, WindowEnumProc func, IntPtr lParam);
public static extern bool EnumChildWindows(IntPtr hwnd, WindowEnumProc callback, IntPtr lParam);
internal static extern bool EnumWindows(WindowEnumProc callPtr, IntPtr lParam);
public static extern bool EnumWindows(WindowEnumProc func, IntPtr lParam);
public static extern bool EnumChildWindows(IntPtr hWnd, WindowEnumProc func, ref SearchData lParam);
static extern bool EnumWindows(WindowEnumProc enumProc, int lparam);
public static extern bool EnumWindows(WindowEnumProc enumFunc, int lParam);
public static extern bool EnumChildWindows(IntPtr hwnd, WindowEnumProc lpEnumCallbackFunction, IntPtr lParam);
private static extern bool EnumWindows(WindowEnumProc enumFunc, uint lParam);
public static extern bool EnumDesktopWindows(IntPtr hDesktop, WindowEnumProc lpEnumCallbackFunction, IntPtr lParam);
[DllImport("user32.dll")] public static extern bool EnumChildWindows(IntPtr hwnd, WindowEnumProc func, IntPtr lParam);
[DllImport("user32.dll")] public static extern bool EnumChildWindows (IntPtr hwnd, WindowEnumProc func, IntPtr lParam);
[DllImport("user32.dll")] public static extern bool EnumThreadWindows(int threadId, WindowEnumProc func, IntPtr lParam);
public static extern bool EnumThreadWindows(int threadId, WindowEnumProc func, IntPtr lParam);
private static extern bool EnumChildWindows(IntPtr window, WindowEnumProc callback, IntPtr lParam);