FreeConsole Function

Detaches the calling process from its console.

Syntax

C++
BOOL WINAPI FreeConsole(void);

Parameters

This function has no parameters.

Return Value

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

A process can be attached to at most one console. If the calling process is not already attached to a console, the error code returned is ERROR_INVALID_PARAMETER (87).

A process can use the FreeConsole function to detach itself from its console. If other processes share the console, the console is not destroyed, but the process that called FreeConsole cannot refer to it. A console is closed when the last process attached to it terminates or calls FreeConsole. After a process calls FreeConsole, it can call the AllocConsole function to create a new console or AttachConsole to attach to another console.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWincon.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll

See Also

AllocConsole
AttachConsole
Console Functions
Consoles

Send comments about this topic to Microsoft

Build date: 10/8/2009

Tags :


Community Content

Đonny
Visual Basic 9 Declaration
Public Declare Function FreeConsole Lib "kernel32.dll" () As Boolean
Tags : vb declaration

Page view tracker