BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Open Picture Dialog Box fails in opening invalid BMP file

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
Prabhu S
Guest





PostPosted: Thu Dec 08, 2005 10:24 am    Post subject: Open Picture Dialog Box fails in opening invalid BMP file Reply with quote




Hi,

I used Inbuilt Open Picture Dialog Box. I set the Filter Property of Open Picture Dialog Box to *.bmp

I'm able to open a valid BMP file. But if a open an invalid BMP file, an exception is generated saying "Project Project1.exe raised an exception class EInvalidGraphic".

The code which I wrote,

if(OpenPictureDialog1->Execute())
{
filename = OpenPictureDialog1->FileName;
}

When I debugged, the control is not comming to the statement
"filename = OpenPictureDialog1->FileName;"

It is getting failed in the statement "OpenPictureDialog1->Execute()".

Why the exception is generated ? How to Solve it ?

Thank you.

Regards,
Prabhu S
Back to top
Hans Galema
Guest





PostPosted: Thu Dec 08, 2005 11:38 am    Post subject: Re: Open Picture Dialog Box fails in opening invalid BMP fil Reply with quote



Prabhu S wrote:

Quote:
Why the exception is generated ?

Because the file is an not a proper .bmp file.

Quote:
How to Solve it ?

What do you want to solve ? How do you want your program
to behave ?

You could place a try-catch blok around the code and
use ShowMessage in the catch to tell the user
that something is wrong with the file.

Hans.

Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Dec 08, 2005 6:32 pm    Post subject: Re: Open Picture Dialog Box fails in opening invalid BMP fil Reply with quote




"Prabhu S" <prabhus (AT) tataelxsi (DOT) co.in> wrote


Quote:
"Project Project1.exe raised an exception class EInvalidGraphic".

It looks like you are running your program inside the IDE debugger. In
which case, what you describe is perfectly normal. TBitmap is throwing the
exception when trying to display a preview of the invalid file.
TOpenPictureDialog will handle the exception internally and ignore the file.
The only reason you see the exception at all is because the debugger dispays
all exceptions. Simply press F9 to continue. The exception will never
reach your code.


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.