EXCEPTION_CONTINUE_EXECUTION

Let’s take a closer look at the exception filter to see how it evaluates to one of the three exception identifiers defined in Excpt.h. In Funcmeister2 the EXCEPTION_EXECUTE_HANDLER identifier is hard-coded directly into the filter for simplicity’s sake, but you can make the filter call a function that will determine which of the three identifiers should be returned. Here’s another code example:

TCHAR g_szBuffer[100]; void FunclinRoosevelt1() { int x = 0; TCHAR *pchBuffer = NULL; __try { *pchBuffer = TEXT('J'); x = 5 / x; } __except (OilFilter1(&pchBuffer)) { MessageBox(NULL, TEXT("An exception occurred"), NULL, MB_OK); } MessageBox(NULL, TEXT("Function completed"), NULL, MB_OK); } LONG OilFilter1(TCHAR **ppchBuffer) ...

Get Windows® via C/C++, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.