Click here to Skip to main content
15,924,507 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to open new windows at the top of z-order, when process is not current process ? Pin
Defenestration8-Jun-04 12:34
Defenestration8-Jun-04 12:34 
AnswerRe: How to open new windows at the top of z-order, when process is not current process ? Pin
Ravi Bhavnani8-Jun-04 21:42
professionalRavi Bhavnani8-Jun-04 21:42 
AnswerRe: How to open new windows at the top of z-order, when process is not current process ? Pin
Diddy9-Jun-04 2:32
Diddy9-Jun-04 2:32 
GeneralRe: How to open new windows at the top of z-order, when process is not current process ? Pin
Defenestration9-Jun-04 18:01
Defenestration9-Jun-04 18:01 
GeneralRe: How to open new windows at the top of z-order, when process is not current process ? Pin
Diddy9-Jun-04 23:44
Diddy9-Jun-04 23:44 
GeneralRe: How to open new windows at the top of z-order, when process is not current process ? Pin
Defenestration10-Jun-04 11:20
Defenestration10-Jun-04 11:20 
GeneralInteger & floating point divide by zero... Pin
herbert_chow8-Jun-04 12:12
herbert_chow8-Jun-04 12:12 
GeneralRe: Integer & floating point divide by zero... Pin
John R. Shaw8-Jun-04 15:52
John R. Shaw8-Jun-04 15:52 
I ran a test and to my supprise, no exception was generated! Why? I am still looking for the answer.

Look in MSDN library under the following:
"Floating-Point Exception Modes"
and
"_controlfp"

I hope that is some help!

Here is a clip from a math parser I wrote (in C) back in 1994 (the code still works):
/* --------------------------------------------------------------------- */
/*
**  Note: The purpose of the arrays is to prevent
**      multiple copys of error strings being used.
*/
int matherr( struct exception *except )
{
    char t = *(_User.def.name);
    int endx=-1, sndx=-1, n = _User.def.nargs;
    char *str[2] = { "is","caused" };
    char *errors[6] =
    {
        "outside the domain",            /* 0 */
        "an illegal value",              /* 1 */
        "overflow",                      /* 2 */
        "underflow",                     /* 3 */
        "partial loss of significance",  /* 4 */
        "total loss of significance",    /* 5 */
    };
    switch( except->type )
    {
        case DOMAIN:    endx = 0 ; sndx = 0 ; break ;
        case SING:      endx = 1 ; sndx = 0 ; break ;
        case OVERFLOW:  endx = 2 ; sndx = 1 ; break ;
        case UNDERFLOW: endx = 3 ; sndx = 1 ; break ;
        case PLOSS:     endx = 4 ; sndx = 1 ; break ;
        case TLOSS:     endx = 5 ; sndx = 1 ; break ;
    }
    if( t && endx>-1 && sndx>-1)
    {
        /* if there is only one argument it has to have caused the error */
        /***** REMOVE THIS FOR "GRAPHIT" ERROR PRINTING ******************
        if( n == 1 )
            _Error( "math","'%s': %G %s %s",
                    _User.def.name,except->arg1,str[sndx],errors[endx] );
        else
        ******************************************************************/
            _Error( "math","'%s': argument %s %s",
                    _User.def.name,str[sndx],errors[endx] );
    }
    else _Error( "math",errors[endx] );
    return 1;
}
/* --------------------------------------------------------------------- */

#include <float.h>
#include <signal.h>
static void fphandler( int sig, int num );

static char *_FpeErrors[10] =
{
    "invalid number",                   /* 0 */
    "denormal",                         /* 1 */
    "divide by zero",                   /* 2 */
    "overflow",                         /* 3 */
    "underflow",                        /* 4 */
    "inexact",                          /* 5 */
    "unemulated",                       /* 6 */
    "square root of negative number",   /* 7 */
    "stack underflow",                  /* 8 */
    "unknown",                          /* 9 */
};

void p_setfperror(void)
{
    /* Set up floating-point error handler. */
    if( signal( SIGFPE, fphandler ) == SIG_ERR )
        _Error( "p_setfperror","could not set floating point error handler" );
    else _FpeSet = 1;
}

/* Handles SIGFPE (floating-point error) interrupt. */
static void fphandler( int sig, int fperr )
{
    int ndx;
    /* Initialize floating-point package. */
    _fpreset();

    /* This function my be causing a stack underflow */
    /* Stop multiple _FpeMsg setting */
    if( _Error_Flag > -1 )
    {
        switch( fperr )
        {
            case FPE_INVALID:           ndx = 0; break;
            case FPE_DENORMAL:          ndx = 1; break;
            case FPE_ZERODIVIDE:        ndx = 2; break;
            case FPE_OVERFLOW:          ndx = 3; break;
            case FPE_UNDERFLOW:         ndx = 4; break;
            case FPE_INEXACT:           ndx = 5; break;
            case FPE_UNEMULATED:        ndx = 6; break;
            case FPE_SQRTNEG:           ndx = 7; break;
            case FPE_STACKUNDERFLOW:    ndx = 8; break;
            default:                    ndx = 9;
        }
        _FpeMsg = _FpeErrors[ndx];
    }
    _Error_Flag = -1;
}


Good Luck!

INTP
GeneralRe: Integer &amp; floating point divide by zero... Pin
Anonymous8-Jun-04 18:06
Anonymous8-Jun-04 18:06 
GeneralRe: Integer &amp; floating point divide by zero... Pin
John R. Shaw8-Jun-04 19:04
John R. Shaw8-Jun-04 19:04 
GeneralRe: Integer &amp; floating point divide by zero... Pin
Ryan Binns8-Jun-04 18:26
Ryan Binns8-Jun-04 18:26 
GeneralRe: Integer &amp; floating point divide by zero... Pin
herbert_chow8-Jun-04 20:34
herbert_chow8-Jun-04 20:34 
GeneralChild window resizing.. Pin
Bob Stanneveld8-Jun-04 12:10
Bob Stanneveld8-Jun-04 12:10 
GeneralRe: Child window resizing.. Pin
valikac8-Jun-04 12:57
valikac8-Jun-04 12:57 
GeneralRe: Child window resizing.. Pin
Bob Stanneveld9-Jun-04 5:01
Bob Stanneveld9-Jun-04 5:01 
GeneralRe: Child window resizing.. Pin
Vadim Tabakman8-Jun-04 13:57
Vadim Tabakman8-Jun-04 13:57 
GeneralRe: Child window resizing.. Pin
Bob Stanneveld9-Jun-04 5:03
Bob Stanneveld9-Jun-04 5:03 
GeneralSolution! Pin
Bob Stanneveld9-Jun-04 5:01
Bob Stanneveld9-Jun-04 5:01 
QuestionWhy do VC++6 Service Packs cause code size to vary ? Pin
Defenestration8-Jun-04 11:49
Defenestration8-Jun-04 11:49 
AnswerRe: Why do VC++6 Service Packs cause code size to vary ? Pin
John R. Shaw8-Jun-04 16:09
John R. Shaw8-Jun-04 16:09 
GeneralRe: Why do VC++6 Service Packs cause code size to vary ? Pin
Defenestration8-Jun-04 16:53
Defenestration8-Jun-04 16:53 
GeneralRe: Why do VC++6 Service Packs cause code size to vary ? Pin
John R. Shaw8-Jun-04 19:24
John R. Shaw8-Jun-04 19:24 
General3D File viewer Pin
suiram408-Jun-04 10:47
suiram408-Jun-04 10:47 
GeneralRe: 3D File viewer Pin
Vadim Tabakman8-Jun-04 13:31
Vadim Tabakman8-Jun-04 13:31 
GeneralRe: 3D File viewer Pin
Iain Clarke, Warrior Programmer9-Jun-04 5:25
Iain Clarke, Warrior Programmer9-Jun-04 5:25 

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.