john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

win errors try except

windows try and except blocks

excuted in event of an error is placed in an __except block.

The EXCEPTION_EXECUTE_HANDLER constant in the __except block indicates that errors will be handled by the block and not passed to other handlers.

LRESULT CALLBACK WndProc(HWND hWnd,
UINT message, WPARAM wParam, LPARAM lParam)
{

    __try
    {
        char* lpC = 0;
        *lpC = 'A';


        default:
            return DefWindowProc(hWnd, message, 
                wParam, lParam);
    }

    __except(EXCEPTION_EXECUTE_HANDLER)
    {
    MessageBox(hWnd,
    _T("Page Fault Caught in exception handling!"),
    szTitle, MB_OK | MB_ICONEXCLAMATION);
    }

}   /* end WndProc */

  • « css basics class override priority
  • blackberry without bes plan »

Published

May 18, 2010

Category

c

~74 words

Tags

  • c 95
  • errors 6
  • except 2
  • try 3
  • win 19