示例#1
0
        public IntPtr EnumAllWindow(string processName, EnumWindProc proc, object obj)
        {
            Process process = GetProcess(processName);

            if (process == null)
            {
                return(IntPtr.Zero);
            }

            WindowsAPI.ShowWindow(process.MainWindowHandle, 1);
            IntPtr       enumAllWindowIsSuccess = IntPtr.Zero;
            EnumWindProc enumAllWindProc        = proc;

            foreach (ProcessThread th in process.Threads)
            {
                WindowsAPI.EnumThreadWindows(th.Id, new EnumWindProc((hwnd, lptr) =>
                {
                    if (!enumAllWindProc(hwnd, lptr))
                    {
                        return(false);
                    }

                    IntPtr intptr = WindowsAPI.EnumChildWindows(hwnd, enumAllWindProc, lptr);
                    return(intptr == IntPtr.Zero);
                }
                                                                     ), IntPtr.Zero);
                if (enumAllWindowIsSuccess != IntPtr.Zero)
                {
                    return(enumAllWindowIsSuccess);
                }
            }

            return(IntPtr.Zero);
        }
 public static extern int EnumChildWindows(IntPtr hWnd, EnumWindProc lpEnumFunc, ref int lParam);
示例#3
0
 public static extern IntPtr EnumThreadWindows(int dwThreadId, EnumWindProc proc, IntPtr lParam);
示例#4
0
 public static extern IntPtr EnumChildWindows(IntPtr hWnd, EnumWindProc proc, IntPtr lParam);
示例#5
0
 public static extern void EnumWindows(EnumWindProc lpEnumFunc, IntPtr lParam);
示例#6
0
 private static extern int EnumChildWindows(IntPtr hWnd, EnumWindProc lpEnumFunc, ref IntPtr lParam);