windows_programming_notes.nbk: Home | Index | Next Page: GetScrollInfo | Previous Page: GetRValue


 GetSaveFileName

The GetSaveFileName function creates a Save dialog box that lets the user specify the drive, directory, and name of a file to save.

Syntax

    BOOL GetSaveFileName(  
        LPOPENFILENAME lpofn
    );

Parameters

Return Value

If the user specifies a file name and clicks the OK button and the function is successful, the return value is nonzero. The buffer pointed to by the lpstrFile member of the OPENFILENAME structure contains the full path and file name specified by the user.

If the user cancels or closes the Save dialog box or an error such as the file name buffer being too small occurs, the return value is zero. To get extended error information, call the CommDlgExtendedError function, which can return one of the following values:

Remarks

The Explorer-style Save dialog box that provides user-interface features that are similar to the Microsoft Windows Explorer. You can provide an OFNHookProc hook procedure for an Explorer-style Save dialog box. To enable the hook procedure, set the OFN_EXPLORER and OFN_ENABLEHOOK flags in the Flags member of the OPENFILENAME structure and specify the address of the hook procedure in the lpfnHook member.

= Windows continues to support old-style Save dialog boxes for applications that want to maintain a user-interface consistent with the old-style user-interface. To display the old-style Save dialog box, enable an OFNHookProcOldStyle hook procedure and ensure that the OFN_EXPLORER flag is not set. =

Windows NT 4.0: The OPENFILENAME structure include additional members on recent versions of Windows. However, this causes problems for applications on previous operation systems. To use the current header files for applications on Microsoft Windows NT 4.0, either use the

#define "/D_WIN32_WINNT=0x0400" or use OPENFILENAME_SIZE_VERSION_400 for

the lStructSize member of OPENFILENAME.

Windows 95/98/Me: GetSaveFileNameW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems .

Function Information


windows_programming_notes.nbk: Home | Index | Next Page: GetScrollInfo | Previous Page: GetRValue


Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time