views:

482

answers:

1

This seems like it ought to be simple, but I've tried both
try {} catch (...) {} C++ exception handling and
__try {} __finally {} structured exception handling (SEH)
and neither one will catch the exception that happens when you Control-C the application.

I didn't really expect C++ exception handling to do this, since the Control-C is a system-type signal and not caused by a C++ throw(), but I tried it anyway when SEH didn't work.

If I run under a debugger, it shows that Control-C raises a first-chance exception, but when it's rethrown, my handler is never invoked.

+1  A: 

Here is how to handle an interrupt in Win32.

http://msdn.microsoft.com/en-us/library/ms686016%28VS.85%29.aspx

Daniel A. White
Thanks, Daniel. I had spent at least an hour searching MSDN with different search engines without finding this.
Die in Sente