[This is preliminary documentation and is subject to change.]

Raised when console is being closed

Namespace:  Tools
Assembly:  Tools.Win (in Tools.Win.dll) Version: 1.5.2.0

Vertion history

1.5.2
Event introduced

Syntax

C#
public static event EventHandler<ConsoleT..::.ConsoleClosingEventArgs> Closing
Visual Basic (Declaration)
Public Shared Event Closing As EventHandler(Of ConsoleT..::.ConsoleClosingEventArgs)
Visual C++
public:
static  event EventHandler<ConsoleT..::.ConsoleClosingEventArgs^>^ Closing {
	void add (EventHandler<ConsoleT..::.ConsoleClosingEventArgs^>^ value);
	void remove (EventHandler<ConsoleT..::.ConsoleClosingEventArgs^>^ value);
}
J#
/** @event */
public static void add_Closing (EventHandler<ConsoleT..::.ConsoleClosingEventArgs> value)
/** @event */
public static void remove_Closing (EventHandler<ConsoleT..::.ConsoleClosingEventArgs> value)
JScript
JScript does not support events.

Remarks

This event is raised in another thread than it was attached.

As this method is static, sender is null

.

This event can be cancelled, but it actually does not prevent user from terminating the application. System dialog to close the application is shown when event is cancelled. The dialog is also show when application does not process this event in some amount of time (usually 5 seconds). On Vista, the application is simply terminated. Ctrl+C and Ctrl+Break can be cancelled this way.

This event can be attached even befor console is allocated using AllocateConsole()()(). Events will be raised after console is allocated. Do not use other means of attaching console to your application than methods of ConsoleT class and using default console of console application, or event will not be raised.

Exceptions

ExceptionCondition
Tools.API..::.Win32APIExceptionUnable to create console control handler when attaching first handler and this application has console allocated

See Also