DCSIMG
How to determine if a console window exists for the current process - Zuker On Foundations

Zuker On Foundations

The realm of .NET (WPF, WCF and all around)
How to determine if a console window exists for the current process

If you need to determine whether there's a console window for the current process, you can do it as follows: 

        [DllImport("kernel32.dll", SetLastError = true)]

        private static extern IntPtr GetConsoleWindow();

 

        internal static bool HasConsoleWindow()

        {

            return GetConsoleWindow() != IntPtr.Zero;

        }

Published Friday, October 02, 2009 12:17 PM by Amir Zuker

תגים:,

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: