CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    May 2007
    Posts
    25

    Question Unable to find setting for exception handling in MFC

    My MDI Project(VC++2010 Professional) is unable to catch errors ,though I return ,try catch block.
    So I developed simple dialog based application .Placed one button on Dialog
    and on its click written following code

    Collapse | Copy Code
    void CMFCExecDlg::OnBnClickedButton1()
    {
    try
    {
    int j = 0;
    int i = 10/j;
    }
    catch(CException * e)
    {
    MessageBox(_T("Hello"),_T(""),MB_OK);
    }
    }

    But still program control does not come in catch block it simply gives error.
    I tried all child classes of CException but no use.I think there will be some setting in Visual Studio Please Help me for How to handle exceptions

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Unable to find setting for exception handling in MFC

    Does division by 0 throw an exception derived from CException?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured