HOWTO: Detect Closure of Command Window from a Console App |
Q102429
The information in this article applies to:
- Microsoft Win32 Application Programming Interface (API), used with:
- the operating system: Microsoft Windows NT, versions 3.1, 3.5, 4.0
- the operating system: Microsoft Windows 2000
SUMMARY
Win32 console applications run in a command window. So that the console application can detect when the console is closing, register a console control handler and look for the following values in your case statement:
CTRL_CLOSE_EVENT User closes the console CTRL_LOGOFF_EVENT User logs off CTRL_SHUTDOWN_EVENT User shuts down the system
For an example, see the CONSOLE sample. For more information, see the entry for SetConsoleCtrlhandler() in the Win32 application programming interface (API) reference.
Additional query words:
Keywords : kbConsole kbKernBase kbOSWin2000 kbDSupport kbGrpDSKernBase
Issue type : kbhowto
Technology : kbAudDeveloper kbWin32sSearch kbWin32API
Last Reviewed: October 27, 2000 |