Solved

TJPEGImage.LoadFromFile

Posted on 1999-01-02
5
352 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
[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
  • 2
5 Comments
 
LVL 20

Accepted Solution

by:
Madshi earned 0 total points
ID: 1354221
Hi Andrew,

use this one:

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

Regards, Madshi.
0
 

Author Comment

by:andrewyu
ID: 1354222
Thank you very much !

But, what is the exception it raise ?

Andrew
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1354223
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
ID: 1354224
Yes, it exact what I meant !

Thank you very much for your help !

Andrew
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1354225
No problem...  :-)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

691 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