Article View: cn.bbs.comp.lang.visual-basic
Article #190Re: ����ð�ť�趨�ļ��в�������·������Text
From: ntal
Date: Sun, 17 Dec 2006 14:30
Date: Sun, 17 Dec 2006 14:30
57 lines
3330 bytes
3330 bytes
�����ҵ���:
http://topic.csdn.net/t/20031114/10/2459570.html
'==================================================
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BROWSEINFO) As Long
Private Const BIF_RETURNONLYFSDIRS = &H1
Private Const BIF_NEWDIALOGSTYLE = &H40
Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
'����ļ��к���
Public Function BrowseFolder(ByVal hwnd As Long, ByVal Title As String) As String
Dim bi As BROWSEINFO
Dim rtn, pid As Long
Dim path As String * 512
Dim pos As Integer
With bi
.hOwner = hwnd
.ulFlags = BIF_RETURNONLYFSDIRS Or BIF_NEWDIALOGSTYLE
.lpszTitle = Title
End With
pid = SHBrowseForFolder(bi)
rtn = SHGetPathFromIDList(ByVal pid, ByVal path)
If rtn Then
pos = InStr(path, Chr(0))
BrowseFolder = Left(path, pos - 1)
Else
BrowseFolder = ""
End If
End Function
Private Sub Command1_Click()
Text1.Text = BrowseFolder(Me.hwnd, "��ѡ�����ļ���")
End Sub
'==================================================
���������command1_click�µĶ������Ƶ����Լ��İ�ť�£�����Text1�ij���Ҫ���淵��·���ı�������TextBox�����֡�
�� �� Ntal (ntal) �Ĵ������ᵽ: ��
: ���һ��text��,����һ����ť,�㰴ť����ֱ����ļ����б�,��ѡij�ļ��в�ȷ�Ϻ�,������·��д��Text,
: ����Ϊ�ܼ�,��û�ҵ����ʵĺ���.
: ��ţ�Ǽ�Ц!
: ...................
--
[m[1;36m�� ��Դ:��ˮľ���� newsmth.net��[FROM: 221.8.5.*][m
Technical Details
Message-ID:
<4RYR7S$1jv@newsmth.net>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newsfeed.gamma.ru!Gamma.RU!newsfeed.simtel.ru!Simtel.RU!news.newsmth.net!NEWSMTHShow Full Headers
Complete Article Headers
X-Google-Thread: 109fdd,dafb3057b69d8d67,start X-Google-Attributes: gid109fdd,public X-Google-Language: ENGLISH,GB Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newsfeed.gamma.ru!Gamma.RU!newsfeed.simtel.ru!Simtel.RU!news.newsmth.net!NEWSMTH From: Ntal@newsmth.net-SPAM.no (ntal) Newsgroups: cn.bbs.comp.lang.visual-basic Subject: Re: ����ð�ť�趨�ļ��в�������·������Text Date: 17 Dec 2006 14:30:54 GMT Organization: ˮľ���� Message-ID: <4RYR7S$1jv@newsmth.net> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 8bit X-Filename: VisualBasic/S/M.1166365804.40