Re: open save dialog with api

Posted by webmaster Guido on February 17, 2001 at 20:22:37:

In Reply to: open save dialog with api posted by gunni on February 15, 2001 at 15:46:52:

: how can i open save dialog from my application. I want to open the windows dialog not to use the component with delphi.

If you just want to change the captions on the buttons, have a look at the TFileDialog component at -- it's freeware with source code.

You also could "roll your own", but I'm not going into details on this one. If you really want to use the Windows stuff, it's quite lengthy... Just to point you in the direction, if you are comfortable with the pointers and structures used in the Win API (that normally Delphi gracefully hides from you ;-) here's what the Win API help file says:
The GetSaveFileName function creates a Save common dialog box that lets the user specify the drive, directory, and name of a file to save.

BOOL GetSaveFileName(
LPOPENFILENAME lpofn // address of structure with initialization data

Parameter: lpofn
Pointer to an OPENFILENAME structure that contai ns information used to initialize the dialog box. When GetSaveFileName returns, this structure contains information about the user's file selection.

Return Value:
If the user specifies a filename and clicks the OK button, the return value is nonzero. The buffer pointed to by the lpstrFile member of the OPENFILENAME structure contains the full path and filename specified by the user.
If the user cancels or closes the Save dialog box or an error occurs, the return value is zero.

That's the easy part. Now, look up the OPENFILENAME structure in the WinApi help, and you'll see what I mean...