Module1.bas
上传用户:szlwled
上传日期:2022-06-30
资源大小:95k
文件大小:1k
源码类别:

视频捕捉/采集

开发平台:

Visual Basic

  1. Attribute VB_Name = "Module1"
  2. Public strFileAVI As String     '何存视频的文件名
  3. Public strFileBMP As String     '保存图片的文件名
  4. Public sngTime As Single    '设置录制时长
  5. Public Function CreateFolder(ByVal strPath As String) As Boolean '逐层创建子文件夹
  6.     Dim iSearch As Integer
  7.     Dim str1 As String
  8.     Dim FileSystemObj As Object
  9.     On Error Resume Next
  10.     Set FileSystemObj = CreateObject("Scripting.FileSystemObject")  '创建文件对象模型
  11.     If Not FileSystemObj.DriveExists(FileSystemObj.GetDriveName(strPath)) Then '若存在该路径
  12.         CreateFolder = False    '设置返回参数
  13.         Exit Function   '退出函数
  14.     End If
  15.     If Right(strPath, 1) <> "" Then  '查找最后是否为“”
  16.         strPath = strPath & "" '在最后添加“”
  17.     End If
  18.     iSearch = InStr(strPath, "")   '搜索分隔符
  19.     Do While iSearch <> 0
  20.         str1 = str1 & Left(strPath, iSearch)    '获取一层子文件夹名称
  21.         strPath = Mid(strPath, iSearch + 1) '去掉前面部分字符
  22.         MkDir str1  '创建一层子文件夹
  23.         If (Not FileSystemObj.DriveExists(str1)) And (Not FileSystemObj.FolderExists(str1)) Then    '若不存在指定驱动器,且不存在指定文件夹
  24.             CreateFolder = False    '设置返回参数
  25.             Exit Function   '退出函数
  26.         End If
  27.         iSearch = InStr(strPath, "")   '搜索下一下分隔符“”
  28.     Loop
  29.     CreateFolder = True '设置返回参数
  30. End Function