Solved

OWL exception handling

Posted on 1997-09-27
3
283 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
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)

911 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now