Solved

TJPEGImage.LoadFromFile

Posted on 1999-01-02
5
343 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
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert Jpg /PNG To GIF 5 134
Delphi application Soap connection 5 103
Delphi IDE crash without error message ... 7 88
Controlled Assessment GCSE - desperate help needed 4 84
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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

813 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

13 Experts available now in Live!

Get 1:1 Help Now