国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > VBScript > 正文

vbs選擇文件夾效果代碼

2020-03-24 19:07:57
字體:
供稿:網(wǎng)友
不用組件的話有兩種辦法:

set objFile = CreateObject("SAFRCFileDlg.FileOpen")
Set objShell = CreateObject("Shell.Application")

本blog里都有示例。

如果調(diào)用vb組件,可以是:

flag = &h200
whichone = OpenFile("Choose a File!", "C:/", "Everything|*.*|TextFiles|*.TXT|Word-Documents|*.DOC", 2, flag)
MsgBox "Raw data returned: " & whichone
' Split up multi selection result:
' space is used as separator:
whichone = Split(whichone, " ")
' field index 0 contains path information:
path = whichone(0)
' list all the files:
' how many files were selected?
filecount = UBound(whichone)
if filecount=0 then
' just one file selected!
MsgBox "You selected one file: " & whichone(0)
' check status of Read Only checkbox
' is bit 1 set or cleared?
' works only if just one file was selected!
MsgBox "Returned flag: " & flag
if (flag and 1) then
' (flag and 1) 0, transforms to true
' bit is set!
MsgBox "ReadOnly selected!"
else
MsgBox "ReadOnly not selected!"
end If
' check whether selected file is of default type (txt)
if (flag and 1024) then
MsgBox "selected file is no txt file!"
else
MsgBox "selected file is of default type!"
end if
else
' more than one file selected!
MsgBox "You selected " & filecount & " files!"
for x = 1 to UBound(whichone)
list = list & path & whichone(x) & vbCr
next
MsgBox list
end If

function OpenFile(title, dir, filter, index, flags)
set comdlg = CreateObject("MSComDlg.CommonDialog")
comdlg.filter = filter
comdlg.FilterIndex = index
comdlg.Flags = flags
comdlg.MaxFileSize = 260
comdlg.CancelError = false
comdlg.DialogTitle = title
comdlg.InitDir = dir
' set txt as default
comdlg.DefaultExt = "txt"
comdlg.ShowOpen
OpenFile = comdlg.filename
' important: return flag status so your main script can
' check it:
flags = comdlg.Flags
end function

組件相關文件下載 http://xiazai.phpstudy.net/jbtools/vb6controls.rarhtml教程

鄭重聲明:本文版權歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 佛山市| 道孚县| 县级市| 莱芜市| 大名县| 登封市| 定边县| 淳安县| 余庆县| 新密市| 思南县| 东港市| 合阳县| 黄浦区| 大足县| 沙河市| 扎兰屯市| 田东县| 长武县| 壤塘县| 南充市| 思南县| 阳新县| 东方市| 柘荣县| 盘山县| 读书| 定结县| 桐乡市| 页游| 连江县| 阿图什市| 敖汉旗| 凌源市| 南京市| 繁昌县| 来凤县| 包头市| 姚安县| 潜山县| 南雄市|