Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How To

Get the extension of the filename to change when the filetype is changed in a save dialog box by DelphiAaron
Posted: 1 Dec 05

Many products have this feature on their save dialogs, e.g. in Excel if the filename in the Save dialog is showing as "Book1.xls" and you change the File Type to ".txt" then filename is automatically changed to "Book1.txt"

This example uses an standard  FileSaveAs Action with an embedded dialog.

First add a reference to CommDlg.


This code is attached to the change file type event which fires when the user changes the extension combobox.

Then extract the new extension from the filter list, change the filename and send it back to the dialog box.


procedure TForm1.FileSaveAs1SaveDialogTypeChange(Sender: TObject);
   I : Integer;
   Fn, Ext : String;
   ExtList : TStringList;
     CB_FILENAME_ID = 1148;
     if I>0 then Ext:=Copy(Ext,1,I-1);
     SendMessage( GetParent(FileSaveAs1.Dialog.Handle), CDM_SETCONTROLTEXT, CB_FILENAME_ID, LongInt(Pchar(Fn)));

Back to Embarcadero: Delphi FAQ Index
Back to Embarcadero: Delphi Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close