Click here to Skip to main content
15,914,419 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Registry Class - Writes to both Windows 95 and Windows 98 Pin
Mike Dunn28-May-00 16:45
Mike Dunn28-May-00 16:45 
QuestionHow to set a individual row-picture (Bitmap) in ClistCtrl ? Pin
Sascha28-May-00 7:43
Sascha28-May-00 7:43 
AnswerRe: How to set a individual row-picture (Bitmap) in ClistCtrl ? Pin
Dmitriy29-May-00 5:22
Dmitriy29-May-00 5:22 
AnswerRe: How to set a individual row-picture (Bitmap) in ClistCtrl ? Pin
Paolo Messina30-May-00 11:03
professionalPaolo Messina30-May-00 11:03 
GeneralMenu in the menu bar Pin
Member 403228-May-00 5:41
Member 403228-May-00 5:41 
GeneralRe: Menu in the menu bar Pin
Brian Hart25-Jun-00 13:23
Brian Hart25-Jun-00 13:23 
GeneralInteger operations Pin
Andreas Jäger27-May-00 22:19
Andreas Jäger27-May-00 22:19 
GeneralRe: Integer operations Pin
Tim Deveaux28-May-00 8:01
Tim Deveaux28-May-00 8:01 
You can test the overflow flag with the _asm instructions jno and jo. You can also explicitly invoke the integer overflow trap if you want to use exceptions:

void CTestDirDlg::OnButton2() 
{
    // test big ints...

    int a, b, c;
    a = INT_MAX - 4;
    b = INT_MAX - 25;

    try {
        c = a + b;
        _asm  {
            // if OV flag not set, were ok...
            jno wereOk;
            // overflow occurred - force the trap...
            int 4;  // the asm INTO statement works too... 
       }
    }
    catch(...) {
        MessageBox( "Overflow!", "Error");
    }

    wereOk:
    return;
}


I realize there is the issue of portability here, but its one possible solution - could be refined. Using SEH you might be able to identify the EXCEPTION_INT_OVERFLOW exception with more certainty than the catch(...), and avoid the _asm.

You might not even want to throw the exception, just test the flag.

I think there is code out there somewhere that can convert these kinds of traps to C++ exceptions - or perhaps it would be better to just throw our own exception object, rather than invoking the processor trap. The trap might be useful if you want to enable first-chance exception handling for c0000095.

I can't seem to find a way to enable this trap in the way that we can enable floating point exceptions with controlfp.
GeneralRe: Integer operations Pin
Andreas Jaeger1-Jun-00 5:55
Andreas Jaeger1-Jun-00 5:55 
GeneralDialog Pin
Member 434827-May-00 10:53
Member 434827-May-00 10:53 
Generalurgent:keyborad acts funny on mainframe dlgbar Pin
gordon26-May-00 16:13
gordon26-May-00 16:13 
QuestionMaximizing app at startup - how? Pin
Mike Newberry26-May-00 12:47
sussMike Newberry26-May-00 12:47 
AnswerRe: Maximizing app at startup - how? Pin
Richard Warg26-May-00 13:38
Richard Warg26-May-00 13:38 
AnswerRe: Maximizing app at startup - how? Pin
imsniper28-May-00 23:26
imsniper28-May-00 23:26 
GeneralRe: Maximizing app at startup - how? Pin
Member 7505-Jun-00 18:29
Member 7505-Jun-00 18:29 
GeneralNot responding apps Pin
Bruno Vais26-May-00 8:02
Bruno Vais26-May-00 8:02 
Generalmarcro for comment word-wrap reformat Pin
Philip Winston26-May-00 5:28
Philip Winston26-May-00 5:28 
GeneralCDC::SelectObject returns NULL Pin
Paul Ebert26-May-00 4:27
Paul Ebert26-May-00 4:27 
GeneralHitTest on CTreeCtrl (Dialog Based) Pin
daniel madden26-May-00 4:08
daniel madden26-May-00 4:08 
GeneralRe: HitTest on CTreeCtrl (Dialog Based) Pin
Mike Dunn26-May-00 8:13
Mike Dunn26-May-00 8:13 
GeneralRe: HitTest on CTreeCtrl (Dialog Based) Pin
daniel madden26-May-00 9:39
daniel madden26-May-00 9:39 
GeneralRemoving loaded DLLs after app crash Pin
Jeremy Davis26-May-00 0:04
Jeremy Davis26-May-00 0:04 
GeneralCPrintDialog, customizing Pin
djordj25-May-00 11:27
djordj25-May-00 11:27 
GeneralRe: CPrintDialog, customizing Pin
Chris Meech26-May-00 6:26
Chris Meech26-May-00 6:26 
QuestionIPX programming. Posible in windows? Pin
Markus25-May-00 9:12
Markus25-May-00 9:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.