做除数的之前都判断
if(0 == m_rectmin.Width())

    //异常处理代码

else

     rect.left = recttemp.Width() * lpRect->left/m_rectmin.Width();  

解决方案 »

  1.   

    Structured Exception Handling 异常扑捉 .
      

  2.   

    Structured Exception Handling 异常扑捉 .
      

  3.   

    除数为0判断,是基本的东西吧.
    程序中的每个除数,都要处理 其为0的可能性.
    可以强制改为一个合法的数,或者函数直接返回.
    也可返回一个自己的异常.一般我是这么处理;
    int iWidth = m_rectmin.Width();  
    if(iWidth==0) iWidth = 1;
      

  4.   

    void CEBankDlg::OnSize(UINT nType, int cx, int cy)
    {
    CDialog::OnSize(nType, cx, cy);

    CRect rc; CWnd *pWnd = GetDlgItem(IDC_STA);
    if(pWnd && nType != 1)
    {
    for(int i=0; i < 5; ++i)
    {
    pWnd->GetWindowRect(&rc);
    ScreenToClient(&rc);

    if(m_ClienRc.Width() <= 0 || m_ClienRc.Height() <= 0)
    {
    pWnd->MoveWindow(rc);
    pWnd = GetNextDlgGroupItem(pWnd);
    }
    else
    {
    rc.left = rc.left * cx / m_ClienRc.Width();
    rc.right= rc.right* cx / m_ClienRc.Width();
    rc.top  = rc.top  * cy / m_ClienRc.Height();
    rc.bottom=rc.bottom*cy / m_ClienRc.Height(); pWnd->MoveWindow(rc);
    pWnd = GetNextDlgGroupItem(pWnd);
    }
    }
    }
    GetClientRect(&m_ClienRc);
    Invalidate(TRUE);
    }
      

  5.   

    使用SEH虽然能捕获异常,但是不管除数为0的情况出现在什么位置,提供的崩溃地址都一样0x3fd26e4,没办法使用map定位,不知怎么回事,同样求助啊?