平時使用VB編程時需要用到
下面介紹如何使用Window API顯示一個
General
Declare Function GetOpenFileName Lib
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
在調用對話框的按鈕的click事件輸入下面代碼
Private Sub FileOpen_Click()
Dim ofn As OPENFILENAME
Dim rtn As String
ofn
ofn
ofn
ofn
ofn
ofn
ofn
ofn
ofn
ofn
ofn
rtn = GetOpenFileName(ofn)
If rtn >=
msgbox ofn
Else
msgbox
End If
End Sub
From:http://tw.wingwit.com/Article/os/youhua/201311/10921.html