Compartilhar via


GetOpenFileName (Windows CE 5.0)

Send Feedback

This function creates a system-defined dialog box that enables the user to select a file to open.

BOOLGetOpenFileName( LPOPENFILENAMElpofn);

Parameters

  • lpofn
    [in] Long pointer to an OPENFILENAME structure that contains information used to initialize the dialog box. When GetOpenFileName returns, this structure contains information about the user's file selection.

Return Values

Nonzero indicates that the user specified a file name and clicked the OK button. The buffer pointed to by the lpstrFile member of the OPENFILENAME structure contains the full path and filename specified by the user.

Zero indicates that the user canceled or closed the Open dialog box or that an error occurred. To get extended error information, call GetLastError. GetOpenFileName sets only the ERROR_INVALID_PARAMETER and ERROR_OUTOFMEMORY errors.

Remarks

Not all members of the OPENFILENAME structure are defined in Windows CE. For information about the defined members, see the reference topic for the OPENFILENAME structure.

Windows CE modifies the meaning of the following members of the OPENFILENAME structure when it is passed into the GetOpenFileName function.

  • Flags
    If this member is set to the OFN_PROJECT value, the GetOpenFileName function opens the Folder dialog box. Otherwise, the function opens the Open dialog box.
  • lpstrFile
    When GetOpenFileName returns successfully, this member is used to retrieve full path of the selected file name.
  • lpstrFileTitle
    When GetOpenFileName returns successfully, this member is used to retrieve the project folder name only.
  • lpstrInitialDir
    Pointer to a string that receives the initial folder name, but not the full path name.

When the GetOpenFileName function is called, Windows CE adds the following prespecified undefined members:

  • lpstrCustomFilter
  • lpstrMaxCusFilter
  • lpstrDefExtension
  • lCustData
  • lpfnHook
  • lpstrTemplateName

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Commdlg.h.
Link Library: Fileopen.lib.

See Also

EndDialog | GetSaveFileName | OPENFILENAME

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.