Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

LDialogFile::DoModalSave - Can't seem to set file filters
Started by JezzerP at 12-11-2007 5:41. Topic has 6 replies.

Print Search « Previous Thread Next Thread »
  12-11-2007, 5:41
JezzerP is not online. Last active: 3/17/2008 3:37:45 PM JezzerP



Top 150 Posts
Joined on 05-22-2006
York, UK
Posts 16
LDialogFile::DoModalSave - Can't seem to set file filters
Reply Quote
Hi,

Using Raster Imaging Tools v15 C++ Class Libraries, and I'm having trouble setting the file filters for the LDialogFile::DoModalSave common dialog. The code I have at present just isn't doing what I think it should be doing, and I'm getting the complete list of possible save formats.

    try
    }
        LDialogFile dlg(pBitmap);
        dlg.Initialize(0);

        SAVEDLGPARAMS fsp;
        memset ( &fsp, 0, sizeof ( SAVEDLGPARAMS ) ) ;
        dlg.GetSaveParams(&fsp, sizeof(SAVEDLGPARAMS));
        fsp.nPageNumber = 1;
        fsp.uSaveMulti  = FALSE;

        // Keep file types to a bare minimum so user can understand!
        FILESAVEFORMAT fsf[5];
        fsf[0].nFormat = DLG_FF_SAVE_JPEG;
        fsf[1].nFormat = DLG_FF_SAVE_PNG;
        fsf[2].nFormat = DLG_FF_SAVE_TIFF;
        fsf[3].nFormat = DLG_FF_SAVE_BMP;
        fsf[4].nFormat = DLG_FF_SAVE_PCX;
   
        fsp.uFileFormatsCount = 5;
        fsp.pFileFormats = fsf;
        dlg.SetSaveParams(&fsp);

        .........
    }

Any help would be most welcome.

thanks

Jeremy

   Report 
  12-11-2007, 12:29
GregR is not online. Last active: 8/29/2008 2:25:56 PM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,542
Re: LDialogFile::DoModalSave - Can't seem to set file filters
Reply Quote
Try filling the uStructSize property.  It worked for me.


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);


Greg Ross
LEADTOOLS Technical Support
   Report 
  12-12-2007, 4:13
JezzerP is not online. Last active: 3/17/2008 3:37:45 PM JezzerP



Top 150 Posts
Joined on 05-22-2006
York, UK
Posts 16
Re: LDialogFile::DoModalSave - Can't seem to set file filters
Reply Quote
Thanks for the response, but no, that's not solved it....still getting the full list of possible file save formats

Jeremy

   Report 
  12-12-2007, 8:34
GregR is not online. Last active: 8/29/2008 2:25:56 PM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,542
Re: LDialogFile::DoModalSave - Can't seem to set file filters
Reply Quote
Please send a small sample project (NOT your entire application) that isolates the problem so I can try to reproduce it here.

NOTE: If you are attaching a project or file to the forums...
1.) Zip the file(s) up.
2.) Make sure it is less than 5 MB.  If it is larger, please send an email to support@leadtools.com and we'll send you FTP instructions.
3.) Remove ANY AND ALL unlock codes and LEADTOOLS DLLs.
4.) Do not click the preview button, the attachment will not show up when you post it.
 
If you do not wish to post your file(s) on the forum since they are publically viewable, please send an email to support@leadtools.com and make sure that you include a link to this forum post.


Greg Ross
LEADTOOLS Technical Support
   Report 
  12-12-2007, 10:26
JezzerP is not online. Last active: 3/17/2008 3:37:45 PM JezzerP



Top 150 Posts
Joined on 05-22-2006
York, UK
Posts 16
Re: LDialogFile::DoModalSave - Can't seem to set file filters
Reply Quote
Thanks Greg,

I'll see if I can find time to work-up a small project. However, it will probably work as required if I do that!!

Jeremy

   Report 
  12-12-2007, 10:48
GregR is not online. Last active: 8/29/2008 2:25:56 PM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,542
Re: LDialogFile::DoModalSave - Can't seem to set file filters
Reply Quote
Sometimes that happens, if it does, then you have a working example with which you can compare your main application's code and find the problem.

If you still have the problem in a small sample project, I'll gladly take a look at it.

Greg Ross
LEADTOOLS Technical Support
   Report 
  12-13-2007, 7:01
JezzerP is not online. Last active: 3/17/2008 3:37:45 PM JezzerP



Top 150 Posts
Joined on 05-22-2006
York, UK
Posts 16
Re: LDialogFile::DoModalSave - Can't seem to set file filters
Reply Quote
Thanks for prodding me in the right direction Greg. Got a small app working the way I wanted it to, and it turns out I wasn't setting the size of the SAVEDLGPARAMS structure before calling SetSaveParams(LPSAVEDLGPARAMS). Also, several of my calls into LeadTools methods that return error codes were not surrounded by a try-catch block so I was missing the errors!!

Jeremy

   Report 
Post
LEAD Support Fo... » Developer » Common Dialogs » LDialogFile::DoModalSave - Can't seem to set file filters

Powered by Community Server, by Telligent Systems