WINDOWS console程序截获CTRL+C按键
来源:互联网 发布:scratch趣味编程 pdf 编辑:程序博客网 时间:2024/06/06 08:38
程序代码如下:
- // win32test.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- bool g_exit = false;
- const char *GetEventMessage( DWORD dwCtrlType )
- {
- switch ( dwCtrlType )
- {
- case CTRL_C_EVENT:
- return "CTRL_C_EVENT";
- case CTRL_BREAK_EVENT:
- return "CTRL_BREAK_EVENT";
- case CTRL_CLOSE_EVENT:
- return "CTRL_CLOSE_EVENT";
- case CTRL_LOGOFF_EVENT:
- return "CTRL_LOGOFF_EVENT";
- case CTRL_SHUTDOWN_EVENT:
- return "CTRL_SHUTDOWN_EVENT";
- }
- return "Unknown";
- }
- BOOL WINAPI HandlerRoutine( DWORD dwCtrlType )
- {
- printf( "%s event received/n", GetEventMessage(dwCtrlType ) );
- g_exit = true;
- return TRUE;
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- SetConsoleCtrlHandler( HandlerRoutine, TRUE );
- while ( ! g_exit )
- {
- printf( "main/n" );
- Sleep( 5000 );
- }
- printf( "exit/n" );
- return 0;
- }
- WINDOWS console程序截获CTRL+C按键
- windows和linux下设置控制台CTRL+C等特殊按键的回调函数之后程序结束的过程
- windows 控制台程序 响应 Ctrl+C
- windows 控制台程序 响应 Ctrl+C
- windows console程序一闪而过
- 关于[Ctrl]-c 按键 不是复制!!
- 重要的几个按键Tab Ctrl+c Ctrl+d
- windows 编程,c,c++,console
- C在win32的console下响应CTRL+C
- windows 平台 CONSOLE程序还是Windows程序
- 控制台程序Ctrl +C 退出
- 恢复在console模式下无法使用Ctrl-C
- 屏蔽Windows按键(除却ALT+CTRL+DELETE)
- C++程序屏蔽常规按键(ctrl+alt+delete除外)
- windows console程序和窗口程序
- Linux中Ctrl+C、Ctrl+D等按键操作&进程相关命令
- Linux中Ctrl+C、Ctrl+D等按键操作&进程相关命令
- Linux中Ctrl+C、Ctrl+D等按键操作&进程相关命令
- First Look at Silverlight 2--Part4:使用CSS风元素封装页面外观风格
- 使用 windbg
- asp.net加密2
- HP DL380 G4服务器安装阵列及系统详解
- oracle 性能
- WINDOWS console程序截获CTRL+C按键
- 北京女大学生维权索赔 被告敲诈入狱10个月
- #define的使用总结
- 快速掌握一个语言最常用的50%
- 这段时间开发了一个共享软件,主要做IP资源管理的(SmartIPView),大家有兴趣可以看看,或给指点指点
- window.open属性说明
- 个人外包项目全记 - Best Partner (九)Coding4
- Head First C# 中文版 图文皆译 第二章 page65
- 一张图分出你是用左脑还是右脑!