# Run File Detection In or Out of Process

By default, detection runs in out-of-process mode. However, you can enable in-process detection through the API or in the `formats.ini` file. If the type of process is not specified in the `formats.ini` or in the API, detection runs in out-of-process mode. If the type of process is specified in the `formats.ini` and in the API, the setting in the API takes precedence.

## Specify the Process Type In the formats.ini File

Add the `default_detect_inprocess` flag to a `[FilterSDK_Config]` section in the `formats.ini` file to control the default behavior for detection. Set the flag to `0` for out-of-process detection, and `1` for in-process detection. For example,

    [FilterSDK Config]
    default_detect_inprocess=0

If this flag is not specified, the file detection behavior is determined by the `default_inprocess` flag for filtering. For example, if you set `default_inprocess` to `1`, filtering and file detection runs in in-process mode by default; if you set `default_inprocess` to `0`, filtering and file detection runs in out-of-process mode by default.

If you set both the `default_inprocess` and `default_detect_inprocess` flags, `default_inprocess` controls the default filtering behavior and `default_detect_inprocess` controls the default file detection behavior.

## Specify the Process Type In the API

To run Filter in process, instantiate the Filter object by using the constructor `Filter(string OutputCharSet, UInt32 filterFlags)`, and set the `FilterFlags` argument to `FILTERFLAG_DETECTINPROCESS`. To run detection in out-of-process mode, set `FILTERFLAG_DETECTOUTOFPROCESS`.

    objFilter = new Filter(outputCharSet, FilterConstant.FilterFlagsConstant.FILTERFLAG_DETECTINPROCESS);

_FT_HTML5_bannerTitle.htm