<p>Any failed ASSERT statements on Windows cause the below debug message to appear and freeze the applications execution. I realise this is expected behaviour but it is running periodically on a headless machine so prevent the unit tests from failing, instead waiting on user input indefinitely.</p>

<p>Is there s a registry key or compiler flag I can use to prevent this message box from requesting user input whilst still allowing the test to fail under ASSERT?</p>

<p><strong>Basically, I want to do this without modifying any code, just changing compiler or Windows options.</strong></p>

<p>Thanks!</p>

<p><a href="http://img519.imageshack.us/img519/853/snapshotbu1.png" rel="nofollow noreferrer" title="Microsoft Visual C++ Debug Library ASSERT">Microsoft Visual C++ Debug Library ASSERT http://img519.imageshack.us/img519/853/snapshotbu1.png</a></p>

From MSDN about the ASSERT macro:
In an MFC ISAPI application, an assertion in debug mode will bring up a modal dialog box (ASSERT dialog boxes are now modal by default); this will interrupt or hang the execution. To suppress modal assertion dialogs, add the following lines to your project source file (projectname.cpp):
```
```
// For custom assert and trace handling with WebDbg
#ifdef _DEBUG
CDebugReportHook g_ReportHook;
#endif
```
```
Once you have done this, you can use the WebDbg tool (WebDbg.exe) to see the assertions.