According to Microsoft documentation, in Windows CE 3.0 and above, the DeviceIoControl function, called with the IOCTL_CONSOLE_SETCONTROLCHANDLER control code, will install the Ctrl + C handler in Windows CE. I have not tried myself yet, but something like this "should" work:
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
where consoleHandler is of course your handler Ctrl + C.
Docs:
Required Headers:
Console.hwinbase.h (usually enabled through windows.h).
source share