本人在MSDN中查到有"Select Folder Dialog Box" 的说明,但不知道有没有这种直接选择文件夹的控件,就象选择打开文件的对话框一样,我现在就要选择文件夹的就可以了,请大家帮我一下,马上得用.
解决方案 »
- 三合一优化
- richtextBox 调用文本文件,右边如何对齐
- 关于MSHFlexGrid排序的问题?
- 在不改变打印机进纸方向的前提下如何让打印的字旋转90度?
- 如何在程序中判断需要运行的控件是否已经存在(已经注册)?
- 如何遇到加载错误,应该怎么办[在线等待]
- 如何实现表格内数字的套打?在线等待!!!!
- 有没有API函数可以把MSGBOX上的BUTTON文字改掉
- 做毕业设计,以及软件开发,需要帮忙的请进入!
- **********VB老手们,行动起来,开个作品交流会吧!!!中国软件万岁!!!*************
- vb 里面 对excel操作的一个问题。
- 请教用ShellExecute调用net.exe的语句例子?谢谢
'一个选择目录的代码
'================================'模块部分代码Option ExplicitPrivate Type BrowseInfo
lngHwnd As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End TypePrivate Const BIF_RETURNONLYFSDIRS = 1
Private Const MAX_PATH = 260Private Declare Sub CoTaskMemFree Lib "ole32.dll" _
(ByVal hMem As Long)Private Declare Function lstrcat Lib "Kernel32" _
Alias "lstrcatA" (ByVal lpString1 As String, _
ByVal lpString2 As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32" _
(lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" _
(ByVal pidList As Long, ByVal lpBuffer As String) As LongPublic Function BrowseForFolder(ByVal lngHwnd As Long, ByVal strPrompt As String) As String On Error GoTo ehBrowseForFolder 'Trap for errors Dim intNull As Integer
Dim lngIDList As Long, lngResult As Long
Dim strPath As String
Dim udtBI As BrowseInfo 'Set API properties (housed in a UDT)
With udtBI
.lngHwnd = lngHwnd
.lpszTitle = lstrcat(strPrompt, "")
.ulFlags = BIF_RETURNONLYFSDIRS
End With 'Display the browse folder...
lngIDList = SHBrowseForFolder(udtBI) If lngIDList <> 0 Then
'Create string of nulls so it will fill in with the path
strPath = String(MAX_PATH, 0) 'Retrieves the path selected, places in the null
'character filled string
lngResult = SHGetPathFromIDList(lngIDList, strPath) 'Frees memory
Call CoTaskMemFree(lngIDList) 'Find the first instance of a null character,
'so we can get just the path
intNull = InStr(strPath, vbNullChar)
'Greater than 0 means the path exists...
If intNull > 0 Then
'Set the value
strPath = Left(strPath, intNull - 1)
End If
End If 'Return the path name
BrowseForFolder = strPath
Exit Function 'AbortehBrowseForFolder: 'Return no value
BrowseForFolder = EmptyEnd Function'==========================================
'窗体调用代码Option ExplicitPrivate Sub Command1_Click()
MsgBox BrowseForFolder(Me.hWnd, "清选择目录")
End Sub
奇怪问题:
在论坛(无论哪一个论坛),发贴子时,只要输入标点符号或英文字符,再输入中
文字符,前面输入的标点符号或英文字符就会消失!大家有没有遇到过,怎么解决?
系统:Windows2000 Professonal