try ... catch

This is a discussion on try ... catch within the Windows Programming forums, part of the Platform Specific Boards category; can anyone teach how to use this try and catch function ???...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    77

    try ... catch

    can anyone teach how to use this try and catch function ???

  2. #2
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    77
    thanks
    but i dunno wat is the webby trying to say

  4. #4
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    a) Instead of saying "webby", please say "web site".
    b) Does "mi" mean "me"?
    c) Did you start out learning Dos stuff (the basics), or did you go straight for MFC?
    d) If not, try buying "Sam's Teach Yourself C++ in 21 Days" (it's a book)
    e) Try researching some stuff yourself from that book
    f) Try researching the rest of the stuff on your own from the internet. A lot of this stuff you could have figured out on your own.
    g) If that doesn't work, try taking lessons.
    h) If none of this works, THEN go for the C board.
    i) If you have trouble understanding replies on the C board, find out how old you are. If you are under 11 years old, then you should probably wait until you are that old before learning C++.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    Ditto on the language.
    It just limits your chance of a response.

    Code:
    __try
    {
    //what ever you want to catch exceptions on
    }
    __except(1)//EXCEPTION_EXECUTE_HANDLER known exception so use this code to handle it
    {
        sprintf(sBuffer,"App has caused exception %08X. app may need to be restarted.",_exception_code());
        MessageBox(hWnd,sBuffer,"App Error",MB_ICONERROR);
    }
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  6. #6
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Code:
    int x = 10, y = -20;
    
    try 
    {
         x = ~x++; 
         y = ~y
    		
         if( x != -10 )
              throw( "Failed to switch X" );
         if( y != 20 )
              throw( "Failed to switch Y" );
    		
         cout << "X = " << x << endl;
         cout << "Y = " << y << endl;
    }
    
    catch( const char *msg )
    {
         MessageBox(NULL, msg, "Exception", NULL);
    }
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OOP Question DB Access Wrapper Classes
    By digioz in forum C# Programming
    Replies: 2
    Last Post: 09-07-2008, 04:30 PM
  2. How do I catch an exception thrown from a linked DLL?
    By 6tr6tr in forum C++ Programming
    Replies: 2
    Last Post: 04-24-2008, 07:49 AM
  3. What can be done with catch(...)?
    By 6tr6tr in forum C++ Programming
    Replies: 6
    Last Post: 04-17-2008, 10:27 AM
  4. Is there a catch to return in a try/catch box?
    By meili100 in forum C++ Programming
    Replies: 25
    Last Post: 11-21-2007, 12:33 PM
  5. Need advice: catch exceptions or call methods to check bits?
    By registering in forum C++ Programming
    Replies: 1
    Last Post: 10-03-2003, 01:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21