Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, March 17, 2008 5:42:55 AM(UTC)

JezzerP  
JezzerP

Groups: Registered
Posts: 13


Hi

Using Raster Imaging Tools v15 C++ Class Libraries, and I am having serious problems with LDialogFile::DoModalSave. In two apps calls to this are causing run-time crashes in different places. In one app, the crash occurs the instant I call this function, and the app just closes. In the second app, the dialog is displayed, but the app crashes the moment I select the .bmp file filter. Unfortunately, both applications run perfectly in debug mode in Visual Studio 2005. If I run a realase build from VS2005 I will get an unhandled exception in both case, deep in mfc code.

I run under Vista and the Windows event log is giving me this error:

Faulting application Winlog.exe, version 6.6.3.17, time stamp 0x4785e810, faulting module Ltdlgfile15u.dll, version 15.0.0.3, time stamp 0x473aae49, exception code 0xc0000005, fault offset 0x00024f2a, process id 0x1f20, application start time 0x01c888428bb5727c.

Have absolutely no idea what is going on, and am completely unable to debug this because there are no problems seen in debug builds.

thanks

Jeremy
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, March 17, 2008 11:35:14 PM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

Jeremy,
Does this also happen if you compile our demos or only in your own code? Also, can you try to test your application after you download the latest SDK patches?
To get the latest patches, please send your toolkit serial number to support@leadtools.com and mention this post.

 
#3 Posted : Tuesday, March 18, 2008 12:00:30 AM(UTC)

JezzerP  
JezzerP

Groups: Registered
Posts: 13


Hi Adnan,

Thanks for replying. I have not tried your demos recently, but I don't think I had any problems when I tried them before, so I am guessing that it's just in our code. I have a small application that one of our new team members put together as a training exercise, and the SaveFileDlg works just fine!! I have ported this code more-or-less as-is to our applications and it appears to have solved the problem in one case, but in the second case identical code is still causing a crash when I try to change the file type for saving. If I run a release build of this from VS2005 the crash is consitently occurring in the last case statment in the mfc CFileDialog::OnNotify() function.

We updated our SDK towards the end of last year I think, but could you inform me as to what version of the libraries you are currently on, and I can check what we are using at this end.

regards

Jeremy
 
#4 Posted : Tuesday, March 18, 2008 12:45:41 AM(UTC)

JezzerP  
JezzerP

Groups: Registered
Posts: 13


Ok, some more information for you.

We limit the number of available save file formats using the code supplied in the help files:

        // Limit the filter to bitmap, gif, cmp and jpg
        FILESAVEFORMAT fsf[5];
        fsf[0].nFormat = DLG_FF_SAVE_JPEG;
        fsf[0].uStructSize = sizeof(FILESAVEFORMAT);
        fsf[1].nFormat = DLG_FF_SAVE_PNG;
        fsf[1].uStructSize = sizeof(FILESAVEFORMAT);
        fsf[2].nFormat = DLG_FF_SAVE_TIFF;
        fsf[2].uStructSize = sizeof(FILESAVEFORMAT);
        fsf[3].nFormat = DLG_FF_SAVE_BMP;
        fsf[3].uStructSize = sizeof(FILESAVEFORMAT);
        fsf[4].nFormat = DLG_FF_SAVE_PCX;
        fsf[4].uStructSize = sizeof(FILESAVEFORMAT);
        DlgParams.uFileFormatsCount = 5;

If I have the code like this, the SaveFileDlg will display correctly, but will crash the app if I try to select BMP or PCX formats. If I remove these formats like this:

        // Limit the filter to bitmap, gif, cmp and jpg
        FILESAVEFORMAT fsf[3];
        fsf[0].nFormat = DLG_FF_SAVE_JPEG;
        fsf[0].uStructSize = sizeof(FILESAVEFORMAT);
        fsf[1].nFormat = DLG_FF_SAVE_PNG;
        fsf[1].uStructSize = sizeof(FILESAVEFORMAT);
        fsf[2].nFormat = DLG_FF_SAVE_TIFF;
        fsf[2].uStructSize = sizeof(FILESAVEFORMAT);
        //fsf[3].nFormat = DLG_FF_SAVE_BMP;
        //fsf[3].uStructSize = sizeof(FILESAVEFORMAT);
        //fsf[4].nFormat = DLG_FF_SAVE_PCX;
        //fsf[4].uStructSize = sizeof(FILESAVEFORMAT);
        DlgParams.uFileFormatsCount = 3;

The application will crash as soon as it tries to display the dialog. Of course, none of this happens in debug builds and the applications run perfectly!!

Jeremy
 
#5 Posted : Tuesday, March 18, 2008 1:04:04 AM(UTC)

JezzerP  
JezzerP

Groups: Registered
Posts: 13


Progress....if I don't limit the file formats at all, both of the applications work just fine. Am I setting up the DlgParams incorrectly or something?
 
#6 Posted : Tuesday, March 18, 2008 5:39:44 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)






For each format, you should also define this:
fsf[N].nBppCount = 1; //or more
fsf[N].pFileSaveFormatBpp = <array of FILESAVEFORMATBPP structures>;

If you do that does the crash stop?

 
#7 Posted : Tuesday, March 18, 2008 7:11:18 AM(UTC)

JezzerP  
JezzerP

Groups: Registered
Posts: 13


So, are you saying that for each format I want to show up in the dialog, I MUST define a Sub-formats array, as defined on your help page?

(http://www.leadtools.com/help/leadtools/v14/CommonDlgApi/Dllaux/CustomizingFileFormatLists.htm)

It's the end of the working day here, so I'll have to try this out tomorrow. Thanks for your help so far, I'll let you know how I get on.

Jeremy
 
#8 Posted : Tuesday, March 18, 2008 10:49:09 PM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

Jeremy,

Yes, even
if there is only one value for bits per pixel, such as 24, you should define an array of FILESAVEFORMATBPP structures (one element or more) and pass it.


If you
have 6 file formats in the dialog, you need to define 6 arrays. Each array will contain one or more elements (each element is a structure).

 
#9 Posted : Tuesday, March 18, 2008 11:22:28 PM(UTC)

JezzerP  
JezzerP

Groups: Registered
Posts: 13


So, something like this?

        // Set up the file format subformat arrays
        FILESAVEFORMATBPP jpgFSFBPP[1];
        jpgFSFBPP[0].nFormatBpp = DLG_FF_SAVE_SUB_JPEG24_YUV_444;
        jpgFSFBPP[0].uStructSize = sizeof(FILESAVEFORMATBPP);

        // Limit the filter to bitmap, gif, cmp and jpg
        FILESAVEFORMAT fsf[5];
        fsf[0].nFormat = DLG_FF_SAVE_JPEG;
        fsf[0].uStructSize = sizeof(FILESAVEFORMAT);
        fsf[0].nBppCount = 1;
        fsf[0].pFileSaveFormatBpp = jpgFSFBPP;
       ...................

What about formats like PNG which have no subformats?

thanks

Jeremy
 
#10 Posted : Tuesday, March 18, 2008 11:58:02 PM(UTC)

JezzerP  
JezzerP

Groups: Registered
Posts: 13


No, I'm still doing something wrong...is there an example somewhere for setting up these FILESAVEFORMATBPP structs? This really isn't particularly well documented!!
 
#11 Posted : Wednesday, March 19, 2008 4:11:22 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)










 The nFormatBpp member should be set to a value such as 24 or 8 (bits per pixel).
The
subtype, such as DLG_FF_SAVE_SUB_JPEG24_YUV_444, goes into the uSubFormats member.
About formats that don't have subtypes, pass 0 in the uSubFormats member.

 
#12 Posted : Wednesday, March 19, 2008 4:35:17 AM(UTC)

JezzerP  
JezzerP

Groups: Registered
Posts: 13


Adnan,

That's great!! Looks like it's working now....I'll be back if it isn't ;-)

Thanks for all your help.

Jeremy
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.389 seconds.