This documentation is archived and is not being maintained.

Exception Handling (SEH)

Visual Studio .NET 2003

Windows 95, Windows 98, and Windows 2000 (formerly Windows NT) support a robust approach to handling exceptions, called structured exception handling, which involves cooperation of the operating system but also has direct support in the programming language.

An "exception" is an event that is unexpected or disrupts the ability of the process to proceed normally. Exceptions can be detected by both hardware and software. Hardware exceptions include dividing by zero and overflow of a numeric type. Software exceptions include those you detect and signal to the system by calling the RaiseException function, and special situations detected by Windows.

You can write more reliable code with structured exception handling. You can ensure that resources, such as memory blocks and files, are properly closed in the event of unexpected termination. You can also handle specific problems, such as insufficient memory, with concise, structured code that doesn't rely on goto statements or elaborate testing of return codes.

Note   The Structured Exception Handling articles describe structured exception handling for the C programming language. Although structured exception handling can also be used with C++, C++ exception handling should be used for C++ programs. See Using Structured Exception Handling with C++ for information on special considerations.

See Also

Exception Handling | Structured Exception Handling