ShootBlues.Win32.FindProcessWindow C# (CSharp) Méthode

FindProcessWindow() public static méthode

public static FindProcessWindow ( int processId, string className, string windowName ) : IntPtr
processId int
className string
windowName string
Résultat System.IntPtr
        public static IntPtr FindProcessWindow(int processId, string className, string windowName)
        {
            var result = new Future<IntPtr>();
            EnumWindowsProc callback = (hWnd, lParam) => {
                int windowProcessId;
                GetWindowThreadProcessId(hWnd, out windowProcessId);
                if (windowProcessId != processId)
                    return true;
                if ((windowName != null) && (GetWindowTextString(hWnd) != windowName))
                    return true;
                if ((className != null) && (GetWindowClassString(hWnd) != className))
                    return true;

                result.SetResult(hWnd, null);
                return false;
            };

            EnumWindows(callback, IntPtr.Zero);
            if (result.Completed)
                return result.Result;
            else
                return IntPtr.Zero;
        }