Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function retrieves a code that identifies the type of exception that occurred. GetExceptionCodecan be called only from within the filter expression or exception-handler block of a try- exceptexception handler.
DWORD GetExceptionCode(void);
Return Values
The return value identifies the type of exception. Following are the exception codes likely to occur due to common programming errors:
Remarks
The Excpt.h file has to be explicitly included in order to use GetExceptionCode.
The GetExceptionCodefunction can be called only from within the filter expression or exception-handler block of a try- exceptstatement. The filter expression is evaluated if an exception occurs during execution of the tryblock, and it determines whether the exceptblock is executed.
The filter expression can invoke a filter function. The filter function cannot call GetExceptionCode. However, the return value of GetExceptionCodecan be passed as a parameter to a filter function. The return value of the GetExceptionInformationfunction can also be passed as a parameter to a filter function. GetExceptionInformationreturns a pointer to a structure that includes the exception-code information.
The following code example shows the structure of a try- exceptstatement.
try { // try block } except ( FilterFunction(GetExceptionCode() ) { // exception handler block }
In the case of nested try- exceptstatements, each statement's filter expression is evaluated until one is evaluated as EXCEPTION_EXECUTE_HANDLER or EXCEPTION_CONTINUE_EXECUTION. Each filter expression can invoke GetExceptionCodeto get the exception code.
The exception code returned is the code generated by a hardware exception, or the code specified in the RaiseExceptionfunction for a software-generated exception.
When handling the breakpoint exception, it is important to increment the instruction pointer in the context record to continue from this exception.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Excpt.h |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
GetExceptionInformation, RaiseException