Example #1
0
        /// <summary>
        ///     Moves a window to the foreground (ontop of other windows).
        /// </summary>
        /// <param name="hWnd"> The window to move to the foreground. </param>
        /// <remarks>
        ///     <para>
        ///         Nothing happens if <paramref name="hWnd" /> is <see cref="IntPtr.Zero" />.
        ///     </para>
        /// </remarks>
        public static void MoveWindowToForeground(IntPtr hWnd)
        {
            if (hWnd == IntPtr.Zero)
            {
                return;
            }

            WindowsWindow.SetForegroundWindow(hWnd);
            WindowsWindow.BringWindowToTop(hWnd);
            WindowsWindow.SetActiveWindow(hWnd);
        }