Exemple #1
0
        /// <summary>
        /// Shows the application's console
        /// </summary>
        public static bool ShowConsole()
        {
            try
            {
                var handle = UnsafeNative.GetConsoleWindow();

                if (handle == null || handle == IntPtr.Zero)
                {
                    return(false);
                }

                return(UnsafeNative.ShowWindow(handle, UnsafeNative.SW_SHOW));
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #2
0
 /// <summary>
 /// Retrieves the window handle used by the console associated with the calling process.
 /// </summary>
 /// <returns>The return value is a handle to the window used by the console associated with the calling process or NULL if there is no such window associated console.</returns>
 public static IntPtr GetConsoleWindowHandle() => UnsafeNative.GetConsoleWindow();