Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
'系统全局函数========================================================================
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Private Sub Command1_Click()
Dim fName As String, sName As String, OfName As OPENFILENAME
'加载控件 Microsoft Common Dialog Control 6.0(SP3)
Private Sub Command1_Click()
On Error GoTo errorhandler
CommonDialog1.filename = ""
CommonDialog1.ShowOpen
If CommonDialog1.filename <> "" Then
Image1.Picture = LoadPicture(CommonDialog1.filename)
End If
EXIT SUB
errorhandler:
Exit Sub
End Sub