Exemplo n.º 1
0
        internal static int WndEnumProc(IntPtr hwnd, ref WNDENUMPARAMS lParam)
        {
            int processId;
            int threadId = GetWindowThreadProcessId(hwnd, out processId);

            if (processId == lParam.processId)
            {
                //if(IsWindowVisible(hwnd))
                //{
                //must be bigger than 0,0
                RECT r;
                GetWindowRect(hwnd, out r);
                if (r.right - r.left > 0 && r.bottom - r.top > 0)
                {
                    if (GetWindow(hwnd, GW.OWNER) == IntPtr.Zero)
                    {
                        //window process id matches our process
                        lParam.hwnd = hwnd;
                        System.Diagnostics.Debug.WriteLine(hwnd.ToInt32().ToString("X"));
                        //end enumeration
                        return(0);
                    }
                }
                //}
            }

            //try next
            return(-1);
        }
Exemplo n.º 2
0
 internal static extern bool EnumWindows(WNDENUMPROC enumFunc, ref WNDENUMPARAMS lParam);