I need to make some clean up before closing my application, but SetConsoleCtrlHandler
doesn't seem to be available for Windows CE console applications.
Is there any alternative method for handling Ctrl+C
in Windows CE 6?
I need to make some clean up before closing my application, but SetConsoleCtrlHandler
doesn't seem to be available for Windows CE console applications.
Is there any alternative method for handling Ctrl+C
in Windows CE 6?
I got this working on Windows Embedded Compact 7. The Ctrl+C and the "window closed" events are both catched.
Notice that IOCTL_CONSOLE_SETCONTROLCHANDLER has been deprecated and DeviceIoControl() fails when it is given that IOCTL code.
According to Microsoft's documentation, on Windows CE 3.0 and up, the
DeviceIoControl
function called with theIOCTL_CONSOLE_SETCONTROLCHANDLER
control code will install a Ctrl+C handler on Windows CE. I haven't tried it out myself yet, but something like this "should" work:where
consoleHandler
is of course your Ctrl+C handler.Docs:
Headers needed:
Console.h
winbase.h
(usually included through windows.h).