鐢ˋPI鍑芥暟鎵撳紑MSCommonDialog瀵硅瘽妗
鍙戝竷: 2008-7-15 14:49 | 浣滆: 缃戠粶杞浇 | 鏉ユ簮: 缃戠粶杞浇 | 鏌ョ湅: 13娆
鍦ㄦā鍧椾腑鍔犲叆:
Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As- OPENFILENAME) As Long
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
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
鐒跺悗鍦‵orm绐椾綋涓婂姞涓涓枃鏈鍜屾寜閽瓹aption灞炴т负"鎵撳紑".鍙屽嚮鎸夐挳鍔犲叆涓嬪垪浠g爜:
Private Sub Command1_Click()
Dim ofn As OPENFILENAME
Dim rtn As String
ofn.lStructSize=len(ofn)
ofn.hwndOwner=Me.hWnd
ofn.hInstance=App.hInstance
ofn.lpstrFilter="鎵鏈夋枃浠"
ofn.lpstrFile=Space(254)
ofn.nMaxFileTitle=255
ofn.lpstrInitialDir=app.path
ofn.lpstrTitle="鎵撳紑鏂囦欢"
ofn.flags=6148
rtn=GetOpenFileName(ofn)
If rtn>=1 then
Text1.Text=ofn.lpstrFile
Else
Text1.Text="Cancel Was Pressed"
End If
End Sub
杩愯绋嬪簭,鐐瑰嚮"鎵撳紑"鎸夐挳灏变細寮瑰嚭鎵撳紑鏂囦欢瀵硅瘽妗.閫変腑浠讳綍鏂囦欢鍐嶇‘瀹,Text1.Text灏变細鏄剧ず浠讳綍鏂囦欢鍚.




发表于 2009-1-5 19:48
| 











