AddVectoredExceptionHandler function (errhandlingapi.h)

Registers a vectored exception handler.

Syntax

PVOID AddVectoredExceptionHandler(
  ULONG                       First,
  PVECTORED_EXCEPTION_HANDLER Handler
);

Parameters

First

The order in which the handler should be called. If the parameter is nonzero, the handler is the first handler to be called. If the parameter is zero, the handler is the last handler to be called.

Handler

A pointer to the handler to be called. For more information, see VectoredHandler.

Return value

If the function succeeds, the return value is a handle to the exception handler.

If the function fails, the return value is NULL.

Remarks

If the First parameter is nonzero, the handler is the first handler to be called until a subsequent call to AddVectoredExceptionHandler is used to specify a different handler as the first handler.

If the VectoredHandler parameter points to a function in a DLL and that DLL is unloaded, the handler is still registered. This can lead to application errors.

To unregister the handler, use the RemoveVectoredExceptionHandler function function.

To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0500 or later. For more information, see Using the Windows Headers.

Examples

For an example, see Using a Vectored Exception Handler.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header errhandlingapi.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

AddVectoredContinueHandler function, RemoveVectoredExceptionHandler function, Vectored Exception Handling, VectoredHandler