How to know if it is the Windows console?

Is there any safe way to know whether the actual window is the windows console?

GetConsoleTitle does not works since the title can be changed.


When you run CMD (or any console based programs) from your program via CreateProcess or ShellExecuteEx functions, you'll get its process ID. Use it with EnumWindows and GetWindowThreadProcessId to find its console window.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace ConsoleApplication1
    class Program
        static void Main(string[] args)
            Process[] processes = Process.GetProcessesByName("cmd");
            foreach (Process p in processes)
                var window = p.MainWindowHandle;
                // Do something 

Need Your Help

CONCAT() function in a SELECT field list

php database codeigniter activerecord

I'm using CodeIgniter's active record features but I'm not able to select the data I'm interested in.

Hex number operations in c#

c# visual-studio-2010 binary hex

I am making an application in C# and I have hex numbers such as 0x0FF8,0xFFFA etc.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.