please dont rip this site Prev Next

GetExceptionCode info  Overview  Group

The GetExceptionCode function retrieves a code that identifies the type of exception that occurred. The function can be called only from within the filter expression or exception-handler block of a try-except exception handler.

DWORD GetExceptionCode(VOID)


This function has no parameters.

Return Values

The return value identifies the type of exception. Following are the exception codes likely to occur due to common programming errors:




The thread attempted to read from or write to a virtual address for which it does not have the appropriate access.


A breakpoint was encountered.


The thread attempted to read or write data that is misaligned on hardware that does not provide alignment. For example, 16-bit values must be aligned on 2-byte boundaries, 32-bit values on 4-byte boundaries, and so on.


A trace trap or other single-instruction mechanism signaled that one instruction has been executed.


The thread attempted to access an array element that is out of bounds, and the underlying hardware supports bounds checking.


One of the operands in a floating-point operation is denormal. A denormal value is one that is too small to represent as a standard floating-point value.


The thread attempted to divide a floating-point value by a floating-point divisor of zero.


The result of a floating-point operation cannot be represented exactly as a decimal fraction.


This exception represents any floating-point exception not included in this list.


The exponent of a floating-point operation is greater than the magnitude allowed by the corresponding type.


The stack overflowed or underflowed as the result of a floating-point operation.


The exponent of a floating-point operation is less than the magnitude allowed by the corresponding type.


The thread attempted to divide an integer value by an integer divisor of zero.


The result of an integer operation caused a carry out of the most significant bit of the result.


The thread attempted to execute an instruction whose operation is not allowed in the current machine mode.


The thread attempted to continue execution after a noncontinuable exception occurred.


The GetExceptionCode function can be called only from within the filter expression or exception-handler block of a try-except statement. The filter expression is evaluated if an exception occurs during execution of the try block, and it determines whether the except block is executed. The following example shows the structure of a try-except statement.

try { 


    /* try block */ 



except (filter-expression) { 


    /* exception handler block */ 




The filter expression can invoke a filter function. The filter function cannot call GetExceptionCode. However, the return value of GetExceptionCode can be passed as a parameter to a filter function. The return value of the GetExceptionInformation function can also be passed as a parameter to a filter function. GetExceptionInformation returns a pointer to a structure that includes the exception-code information.

In the case of nested try-except statements, each statementís filter expression is evaluated until one is evaluated as EXCEPTION_EXECUTE_HANDLER or EXCEPTION_CONTINUE_EXECUTION. Each filter expression can invoke GetExceptionCode to get the exception code.

The exception code returned is the code generated by a hardware exception, or the code specified in the RaiseException function for a software-generated exception.

See Also

GetExceptionInformation, RaiseException

file: /Techref/os/win/api/win32/func/src/f31_12.htm, 9KB, , updated: 2006/6/19 05:27, local time: 2023/6/10 07:36,

 ©2023 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> GetExceptionCode</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2023 contributors:
o List host: MIT, Site host, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!