Jai*_*ano 3 console winapi signals windows-ce
我需要在关闭应用程序之前进行一些清理,但SetConsoleCtrlHandler似乎不适用于Windows CE控制台应用程序.
Ctrl+C在Windows CE 6中是否有任何其他处理方法?
根据Microsoft的文档,在Windows CE 3.0及更高版本中,DeviceIoControl使用IOCTL_CONSOLE_SETCONTROLCHANDLER控制代码调用的函数将在Windows CE上安装Ctrl + C处理程序.我还没有尝试过,但是这样的"应该"有效:
DWORD ignore;
DeviceIoControl(
_fileno(stdout), // handle to the console
IOCTL_CONSOLE_SETCONTROLCHANDLER, // Tell Win CE to set the console Ctrl+C handler
(LPVOID)consoleHandler, // pointer to the signal handler
sizeof(consoleHandler), // size of the pointer
NULL, // output buffer not needed
0, // zero output buffer size
&ignore, // no data will be put into the output buffer so we don't need its size
NULL); // not an asynchronous operation - don't need to provide async info
Run Code Online (Sandbox Code Playgroud)
这里consoleHandler当然是你按Ctrl + C处理程序.
文档:
标题需要:
Console.hwinbase.h (通常包含在windows.h中).| 归档时间: |
|
| 查看次数: |
2020 次 |
| 最近记录: |