ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 IEExecuteSaveDialog in iexUtils.pas
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jeffp

USA
75 Posts

Posted - Dec 01 2026 :  17:49:17  Show Profile  Reply
We made this change to your code. Thought you might want to consider it. It fixes a crash when the selected file name does not contain an extension.

function IEExecuteSaveDialog( ...


        Result := saveFDlg.FileName;
        if ( Result <> '' ) and ( IEExtractFileExt( Result, False ) = '' ) then
        begin
          ex := saveFDlg.FileTypes[ saveFDlg.FileTypeIndex - 1 ].FileMask;  // NB: saveFDlg.FileTypes is 0-based!!!  c.f. FileTypeIndex

          // Remove *
          if ( ex <> '' ) and ( ex[1] = '*' ) then
            Delete( ex, 1, 1 );

          // Remove ;
          idx := Pos( ';', ex );
          if idx > 0 then
            ex := Copy( ex, 1, idx - 1 );

          Result := Result + ex;
        end;
      end;


jp

xequte

39617 Posts

Posted - Dec 01 2026 :  19:33:12  Show Profile  Reply
Hi Jeff

Thanks very much for sending this, and for tracking down the cause. I've added your fix to ImageEn, with two small additions:
  • The file type index is range checked before the FileTypes list is read
  • Spaces around the extension are trimmed (e.g. *.jpg; *.jpeg)

It will be in the next update. You can email me for a beta if you like.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: