自动搜索电脑中插入的U盘并复制其中文件的程序
来源:百度知道 编辑:UC知道 时间:2024/05/29 08:19:36
给你一个识别U盘的代码:
模块中:
Public Declare Function GetLogicalDriveStrings Lib "kernel32" _
Alias "GetLogicalDriveStringsA" _
(ByVal nBufferLength As Long, _
ByVal lpBuffer As String) As Long
Public Declare Function GetDriveType Lib "kernel32" _
Alias "GetDriveTypeA" _
(ByVal nDrive As String) As Long
Public Const DRIVE_REMOVABLE = 2
Public Const DRIVE_FIXED = 3
Public Const DRIVE_REMOTE = 4
Public Const DRIVE_CDROM = 5
Public Const DRIVE_RAMDISK = 6
窗体中:
Private Sub Command1_Click()
Form1.Cls
Dim r As Long
Dim allDrives As String
Dim currDrive As String
Dim drvType As String
'get the list of all available drives
allDrives = GetDriveString()
&