# SetBreakOnFirstChanceExceptions

int SetBreakOnFirstChanceExceptions (int newState);

## Purpose

If debugging is enabled, this function controls whether LabWindows/CVI displays a run-time error dialog box and suspends execution when a first-chance exception occurs.

In general, use the Break on»First Chance Exceptions option in the Workspace window to control this feature. Use this function when you want the temporarily disable the Break on»First Chance Exceptions feature around a segment of code. SetBreakOnFirstChanceExceptions changes the setting for the thread that calls SetBreakOnFirstChanceExceptions.

### Example

int oldValue;
oldValue = SetBreakOnFirstChanceExceptions (0);
/* function calls that may legitimately return errors */
SetBreakOnFirstChanceExceptions (oldValue);

This function does not affect the state of the Break on»First Chance Exceptions option in the Workspace window.

If debugging is disabled, this function has no effect. Run-time errors are never reported when debugging is disabled. Debugging is enabled when you set the debugging level in the Build Options dialog box of the Workspace window to Standard or Extended.

## Parameters

Input
Name | Type | Description
newState | integer | Determines whether the Break on first chance exceptions feature is enabled on disabled. If the value is non-zero, LabWindows/CVI displays a dialog box and suspends execution when a first-chance exception occurs. If the value is zero, LabWindows/CVI does neither. If debugging is disabled, this parameter has no effect.

## Return Value

Name | Type | Description
previousState | integer | The previous state of the state of the Break on first chance exceptions option. When debugging is disabled, 0 is always returned.
Code | Description
1 | Break on first chance exceptions is enabled.
0 | Break on first chance exceptions is disabled.