The FreeConsole function detaches the calling process from its console.
BOOL FreeConsole(VOID)
Parameters
This function has no parameters.
Return Values
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.
Remarks
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.
See Also