Public Type OPENFILENAME
nStructSize As Long
hWndOwner As Long
hInstance As Long
sFilter As String
sCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
sFile As String
nMaxFile As Long
sFileTitle As String
nMaxTitle As Long
sInitialDir As String
sDialogTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
sDefFileExt As String
nCustData As Long
fnHook As Long
sTemplateName As String
End Type
Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
成功返回0,失败返回其他值
Private Declare Function RunFileDlg Lib "shell32" Alias "#61" (ByVal hwndOwner As Long, ByVal hIcon As Long, ByVal lpstrDirectory As String, ByVal lpstrTitle As String, ByVal lpstrDescription As String, ByVal uFlags As Long) As Long
其中uFlags参数的可选值为
RFF_NOBROWSE 0x01 Removes the browse button.
RFF_NODEFAULT 0x02 No default item selected.
RFF_CALCDIRECTORY 0x04 Calculates the working directory from the file name.
RFF_NOLABEL 0x08 Removes the edit box label.
RFF_NOSEPARATEMEM 0x20 Removes the Separate Memory Space check box (Windows NT only).