Solved

OWL exception handling

Posted on 1997-09-27
3
298 Views
Last Modified: 2013-12-26
I am writing for 16-bit Windows using ObjectWindows from Borland C++ 4.52.
By following the examples I can generate & trap specific exceptions.
My problem is to trap exceptions generated by the following fragment:

   char str [100], *sptr = 0;
   strcpy (str, sptr);

Which makes strcpy() take a NULL pointer and generate an Unhandled Exception.

int OwlMain(int /*argc*/, char* /*argv*/ [])
{
   try
      {
      return TDrawApp().Run();
      }
   catch (xmsg& x)
      {
      ::MessageBox(0, x.why().c_str(), "Exception", MB_OK);
      return -1;
      }
   catch (...)
      {
      ::MessageBox(0, "Error Trap", "Exception", MB_OK);
      }
   return -1;
}


I cannot catch the error. Why?
0
Comment
Question by:weltech
3 Comments
 
LVL 3

Accepted Solution

by:
LucHoltkamp earned 100 total points
ID: 1299402
Owl's TApplication::Run() has an internal try-catch block. Any exceptions it doesn't recognize from OWL itself are treated as the Unhandled Exception thing you get. The exception you want to catch in OwlMain never gets there. You'll have to catch the exception before Owl does.
.luc.
0
 

Expert Comment

by:rharlicker
ID: 1299403
Note: This is for 16bit apps only.

Search the internet for the file fault.zip . It includes documentation and sources that show how to trap GPF's by hooking
into the InterruptRegister routine.

0
 

Author Comment

by:weltech
ID: 1299404
Thank you rharlicker
This form doesn't appear to give me a Reward option.
Please take 50 points.

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Hide or Show Images using checkbox array in mysql database 11 294
CSS HELP 6 94
Cordova Camera plugin fails 2 167
asp Google Map 2 65
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question