?
Solved

TJPEGImage.LoadFromFile

Posted on 1999-01-02
5
Medium Priority
?
356 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month7 days, 19 hours left to enroll

765 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