As @AlexanderVX's answer shows an quick answer, I wanted to also show you my final implementation with appropriate comments explaining what does what :] :
Don't forget to set Windows version same or greater than 0x0500 and include windows.h library:
I've put mini-app example on: //ideone.com/CeLQj3
Example with explanation:
// GetConsoleWindow[] => returns: // "handle to the window used by the console // associated with the calling process // or NULL // if there is no such associated console." HWND consoleWindowHandle = GetConsoleWindow[]; if[ consoleWindowHandle ]{ cout