国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表

圖片精選

主站蜘蛛池模板: 泽州县| 徐州市| 永城市| 岑巩县| 青海省| 辽宁省| 山东| 石景山区| 岳西县| 兴安县| 遵义县| 礼泉县| 广元市| 隆回县| 天长市| 伊通| 桦川县| 赤水市| 鹤岗市| 武冈市| 乌拉特前旗| 桦南县| 玉树县| 新郑市| 阿勒泰市| 株洲县| 奇台县| 政和县| 桐梓县| 开阳县| 安仁县| 新邵县| 洮南市| 泽库县| 梁平县| 靖安县| 辛集市| 六安市| 来宾市| 廉江市| 鹤峰县|