Exemple #1
0
        /**/
        /// <summary>
        /// Find the child window, if found m_classname will be assigned
        /// </summary>
        /// <param name="hwndParent">parent's handle</param>
        /// <param name="lParam">the application value, nonuse</param>
        /// <returns>found or not found</returns>
        //The C++ code is that  lParam is the instance of FindWindow class , if found assign the instance's m_hWnd
        private bool FindChildClassHwnd(IntPtr hwndParent, IntPtr lParam)
        {
            WinAPI.EnumWindowProc childProc = new WinAPI.EnumWindowProc(FindChildClassHwnd);
            IntPtr hwnd = WinAPI.FindWindowEx(hwndParent, IntPtr.Zero, this.m_szClassName, this.m_szWndName);

            if (hwnd != IntPtr.Zero)
            {
                this.m_hWnd = hwnd;                                      // found: save it
                return(false);                                           // stop enumerating
            }
            WinAPI.EnumChildWindows(hwndParent, childProc, IntPtr.Zero); // recurse  redo FindChildClassHwnd
            return(true);                                                // keep looking
        }
Exemple #2
0
        private void getTitleChildren(IntPtr titleHWnd)
        {
            var lpEnumFunc = new WinAPI.EnumWindowProc(EnumChildProc);

            WinAPI.EnumChildWindows(titleHWnd, lpEnumFunc, IntPtr.Zero);
        }