Solved

TJPEGImage.LoadFromFile

Posted on 1999-01-02
5
336 Views
Last Modified: 2010-04-04
If the LoadFromFile fail to open a JPEG file, the program will halt and raise a exception !
As a result, how can I control this without halt the program ?

Andrew
0
Comment
Question by:andrewyu
  • 3
  • 2
5 Comments
 
LVL 20

Accepted Solution

by:
Madshi earned 0 total points
Comment Utility
Hi Andrew,

use this one:

  try
    jpeg.LoadFromFile(...);
    result:=true;
  except result:=false end;

Regards, Madshi.
0
 

Author Comment

by:andrewyu
Comment Utility
Thank you very much !

But, what is the exception it raise ?

Andrew
0
 
LVL 20

Expert Comment

by:Madshi
Comment Utility
Heh? What do you mean?

Do you want to have the exception text? Then do something like this:

  try
    ...
    result:='Everything is fine...';
  except
    if ExceptObject is Exception then
         result:=(ExceptObject as Exception).Message
    else result:='Unknown Exception...';
  end;

Regards, Madshi.
0
 

Author Comment

by:andrewyu
Comment Utility
Yes, it exact what I meant !

Thank you very much for your help !

Andrew
0
 
LVL 20

Expert Comment

by:Madshi
Comment Utility
No problem...  :-)
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 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

8 Experts available now in Live!

Get 1:1 Help Now