private void button11_Click(object sender, EventArgs e) { int count = 0; WndEnumProc proc = (IntPtr hwnd, int ItParam) => { count++; Console.WriteLine(hwnd); return(true); }; bool result = Win32API.EnumChildWindows(this.Handle, proc, (IntPtr)1); Console.WriteLine(string.Format("共找到{0}个子窗口", count)); }
public static extern bool EnumWindows(WndEnumProc lpEnumFunc, IntPtr lParam);
private static extern bool EnumWindows(WndEnumProc lpEnumFunc, int lParam);
public static extern bool EnumThreadWindows(uint threadId, WndEnumProc lpfn, IntPtr lParam);
private static extern bool EnumWindows(WndEnumProc callback, int lParam);
private static extern bool EnumChildWindows(IntPtr hWndParent, WndEnumProc callback, int lParam);
internal static extern bool EnumWindows(WndEnumProc lpEnumFunc, in IntPtr lParam);
internal static extern bool EnumWindows(WndEnumProc lpEnumFunc, AutoModeType lParam);
public static extern bool EnumChildWindows( IntPtr hWndParent, WndEnumProc lpEnumFunc, IntPtr lParam);
public static extern int EnumWindows(WndEnumProc lpEnumFunc, int lParam);
public static extern bool EnumThreadWindows( uint dwThreadId, WndEnumProc lpEnumFunc, IntPtr lParam);
private static extern int EnumWindows(WndEnumProc lpEnumFunc, IntPtr lParam);
public static extern int EnumChildWindows(IntPtr hWndParent, WndEnumProc lpfn, int lParam);