The FreeConsole function detaches the calling process from its console.
BOOL FreeConsole(VOID)
This function has no parameters.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If other processes share the console, the console is not destroyed, but the calling process cannot refer to it.
A process can use FreeConsole to detach itself from its current console, and then it can call the AllocConsole function to create a new console.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in wincon.h.
Import Library: Use kernel32.lib.
Consoles and Character-Mode Support Overview, Console Functions, AllocConsole