回 帖 发 新 帖 刷新版面

主题:比较麻烦的问题,看看谁能解决,过来试试看吧。

在PB中如何遍历指定文件夹下的所有内容,最好能给出源码

回复列表 (共1个回复)

沙发

可以去看帮助文件,关键函数:istboxname.DirList ( filespec, filetype {, statictext } ) ,filetype 指定值:16384 + 16 = 16400 为所有 Driver 和 Path

    The following script for the SelectionChanged event for the ListBox lb_FileList calls DirSelect to test whether the user's selection is a file. If not, the script joins the directory name with the file pattern, and calls DirList to populate the ListBox and display the current drive and directory in the StaticText st_FilePath. If the current selection is a file, other code processes the filename:

string ls_filename, ls_filespec = "*.TXT"

IF lb_FileList.DirSelect(ls_filename) THEN

    //If ls_filename is not a file,

    //append directory to ls_filespec.

    ls_filename = ls_filename + ls_filespec

    lb_filelist.DirList(ls_filename, &

      16400, st_FilePath)

ELSE

    ... //Process the file.

END IF

我来回复

您尚未登录,请登录后再回复。点此登录或注册