Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

OWL exception handling

Posted on 1997-09-27
3
Medium Priority
?
320 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Accepted Solution

by:
LucHoltkamp earned 200 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
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…

604 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