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

    How to suppress system error message?

    If my program encounters a system error, how to prevent the system error message from being displayed?

  2. #2
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    Use SetErrorMode(...) look it up on msdn.microsoft.com for the flags you may or may not want to set.

  3. #3
    Join Date
    May 2002
    Location
    Phoenix, AZ
    Posts
    95
    you can use SEH __try{
    }__except(EXCEPTION_CONTINUE_EXECUTION ){} for c code
    or you can use c++ exception handling try{
    }catch(...){} for c++ code



    for egsample if u try the following code, you'll get a gpf

    long* p = 0;
    *p =10;



    but if u try this
    __try{
    long* p = 0;
    *p =10;
    }__except(EXCEPTION_CONTINUE_EXECUTION ){
    }


    or this
    try{
    long* p = 0;
    *p =10;
    }catch(...){
    }

    the hard exception will be trapped and control will go to the __except or catch(...) block

    hope this helps

  4. #4
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    Originally posted by raghupathys
    you can use SEH __try{
    }__except(EXCEPTION_CONTINUE_EXECUTION ){} for c code
    or you can use c++ exception handling try{
    }catch(...){} for c++ code



    for egsample if u try the following code, you'll get a gpf

    long* p = 0;
    *p =10;



    but if u try this
    __try{
    long* p = 0;
    *p =10;
    }__except(EXCEPTION_CONTINUE_EXECUTION ){
    }


    or this
    try{
    long* p = 0;
    *p =10;
    }catch(...){
    }

    the hard exception will be trapped and control will go to the __except or catch(...) block

    hope this helps
    Better to use C++ exception handling and install a set_se_translator(...)

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