Click here to Skip to main content
16,010,394 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralGot it working! Pin
adonisv12-Jun-03 15:46
adonisv12-Jun-03 15:46 
GeneralRe: Got it working! Pin
peterchen12-Jun-03 21:01
peterchen12-Jun-03 21:01 
Generalslider scroll Pin
aguest11-Jun-03 12:44
aguest11-Jun-03 12:44 
Generallist of identifyers Pin
locoone11-Jun-03 12:29
locoone11-Jun-03 12:29 
GeneralRe: list of identifyers Pin
Rage11-Jun-03 23:00
professionalRage11-Jun-03 23:00 
GeneralRe: list of identifyers Pin
Anonymous12-Jun-03 1:36
Anonymous12-Jun-03 1:36 
GeneralHelp on exception handling..please.. Pin
Robert Buldoc11-Jun-03 12:19
Robert Buldoc11-Jun-03 12:19 
GeneralRe: Help on exception handling..please.. Pin
Joaquín M López Muñoz11-Jun-03 19:54
Joaquín M López Muñoz11-Jun-03 19:54 
Use standard try and catch and resort to _set_se_translator to transform SEH exceptions into C++ exceptions, just like the following code shows:
class SEH_exception:public std::runtime_error
{
public:
  SEH_exception(unsigned int code,const char* msg):std::runtime_error(msg),code_(code){}
  unsigned int code()const{return code_;}
private:
  unsigned int code_;
};
 
static void SEH_translator(unsigned int code,EXCEPTION_POINTERS*)
{
  std::string msg;
  switch(code){
    case EXCEPTION_ACCESS_VIOLATION: msg="access violation";break;
    case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: msg="array bounds exceeded";break;
    case EXCEPTION_BREAKPOINT: msg="breakpoint exception";break;
    case EXCEPTION_DATATYPE_MISALIGNMENT: msg="datatype misalignment";break;
    case EXCEPTION_FLT_DENORMAL_OPERAND: msg="flt denormal operand";break;
    case EXCEPTION_FLT_DIVIDE_BY_ZERO: msg="flt divide by zero";break;
    case EXCEPTION_FLT_INEXACT_RESULT: msg="flt inexact result";break;
    case EXCEPTION_FLT_INVALID_OPERATION: msg="flt invalid operation";break;
    case EXCEPTION_FLT_OVERFLOW: msg="flt overflow";break;
    case EXCEPTION_FLT_STACK_CHECK: msg="flt stack check";break;
    case EXCEPTION_FLT_UNDERFLOW: msg="flt underflow";break;
    case EXCEPTION_ILLEGAL_INSTRUCTION: msg="illegal instruction";
    case EXCEPTION_IN_PAGE_ERROR: msg="in page error";break;
    case EXCEPTION_INT_DIVIDE_BY_ZERO: msg="divide by zero";break;
    case EXCEPTION_INT_OVERFLOW: msg="overflow"; break;
    case EXCEPTION_INVALID_DISPOSITION: msg="invalid disposition";break;
    case EXCEPTION_NONCONTINUABLE_EXCEPTION: msg="noncontinuable exception";break;
    case EXCEPTION_PRIV_INSTRUCTION: msg="priv instruction";break;
    case EXCEPTION_SINGLE_STEP: msg="single step trap";break;
    case EXCEPTION_STACK_OVERFLOW: msg="stack overflow";break;
    default:{
      char buf[1024];
      sprintf(buf,"SEH exception (%x)",code);
      msg=buf;
    }
    break;
  }
  throw SEH_exception(code,msg.c_str());
}
 
...
 
// somewhere at the beginning of your program
_set_se_translator(SEH_translator);
 
...
 
try{
 ...
}
catch(SEH_exception& e){
 ...
}
catch(CMemoryException& e){
 ...
}
I guess you can modify the example given to suit your needs. Good luck.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralRe: Help on exception handling..please.. Pin
Robert Buldoc11-Jun-03 20:35
Robert Buldoc11-Jun-03 20:35 
GeneralFormview + Scrollbar Pin
Atlence11-Jun-03 12:10
Atlence11-Jun-03 12:10 
GeneralRe: Formview + Scrollbar Pin
Roger Allen12-Jun-03 0:35
Roger Allen12-Jun-03 0:35 
GeneralRe: Formview + Scrollbar Pin
Atlence12-Jun-03 12:34
Atlence12-Jun-03 12:34 
GeneralTreeview Pin
Shotgun11-Jun-03 11:25
Shotgun11-Jun-03 11:25 
GeneralRe: Treeview Pin
Michael Dunn11-Jun-03 15:06
sitebuilderMichael Dunn11-Jun-03 15:06 
Generalfinding folders Pin
Steve L.11-Jun-03 10:30
Steve L.11-Jun-03 10:30 
GeneralRe: finding folders Pin
valikac11-Jun-03 10:48
valikac11-Jun-03 10:48 
GeneralRe: finding folders Pin
Steve L.11-Jun-03 11:17
Steve L.11-Jun-03 11:17 
GeneralRe: finding folders Pin
valikac11-Jun-03 11:25
valikac11-Jun-03 11:25 
GeneralRe: finding folders Pin
Anonymous11-Jun-03 21:21
Anonymous11-Jun-03 21:21 
Generalclass troubles! Pin
John Kohn11-Jun-03 10:20
sussJohn Kohn11-Jun-03 10:20 
GeneralRe: class troubles! Pin
Joaquín M López Muñoz11-Jun-03 10:26
Joaquín M López Muñoz11-Jun-03 10:26 
GeneralRe: class troubles! Pin
John Kohn11-Jun-03 11:19
sussJohn Kohn11-Jun-03 11:19 
GeneralRe: class troubles! Pin
Joaquín M López Muñoz11-Jun-03 11:50
Joaquín M López Muñoz11-Jun-03 11:50 
GeneralRe: class troubles! Pin
basementman12-Jun-03 6:37
basementman12-Jun-03 6:37 
GeneralHelp with .EXE file Pin
alexboza11-Jun-03 10:04
alexboza11-Jun-03 10:04 

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.