title: Exceptions silently caught by Windows, how to handle manually?
body: <p>We're having problems with Windows silently eating exceptions and allowing the application to continue running, when the exception is thrown inside the message pump. For example, we created a test MFC MDI application, and overrode OnDraw:</p>
  
  <pre><code>void CTestView::OnDraw(CDC* /*pDC*/)
  {
      *(int*)0 = 0; // Crash
  
      CTestDoc* pDoc = GetDocument();
      ASSERT_VALID(pDoc);
      if (!pDoc)
          return;
  
      // TODO: add draw code for native data here
  }
  </code></pre>
  
  <p>You would expect a nasty error message when running the application, but you actually get nothing at all. The program appears to be running perfectly well, but if you check the output window you will see:</p>
  
  <blockquote>
    <p>First-chance exception at
    0x13929384 in Test.exe:
    0xC0000005: Access violation writing
    location 0x00000000.<br>
    First-chance exception at 0x77c6ee42
    in Test.exe: 0xC0150010: The
    activation context being deactivated
    is not active for the current thread
    of execution.</p>
  </blockquote>
  
  <p>I know why I'm receiving the application context exception, but why is it being handled silently? It means our applications could be suffering serious problems when in use, but we'll never know about it, because our users will never report any problems.</p>