;
帖子
3919 
精华
积分
11710 
鱼币
0 ¥ 
来自
大连 
在线时间
1858 小时 
注册时间
2007-6-11 
最后登录
2009-10-20 

贴图大师勋章新人进步勋章宣传大使勋章论坛元老勋章

3
发表于 2009-1-5 19:48 | 只看该作者
鐢ˋPI鍑芥暟鎵撳紑MSCommonDialog瀵硅瘽妗 - 缂栫▼搴 - Powered by SupeSite

浣犵殑浣嶇疆锛缂栫▼搴 >> 璧勮 >> VB >> VBAPI >> 璇︾粏鍐呭 鍦ㄧ嚎鎶曠ǹ

鐢ˋ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灏变細鏄剧ず浠讳綍鏂囦欢鍚.

TAG: API 鍑芥暟 瀵硅瘽妗
鎵撳嵃 | 鏀惰棌姝ら〉 |  鎺ㄨ崘缁欏ソ鍙 | 涓炬姤
涓婁竴绡 涓嬩竴绡
 

璇勫垎锛0

鍙戣〃璇勮
鏌ョ湅鍏ㄩ儴鍥炲銆愬凡鏈0浣嶇綉鍙嬪彂琛ㄤ簡鐪嬫硶銆