请高手帮我解释下这段VB代码

2024-11-28 15:56:33
推荐回答(2个)
回答1:

Public Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long

'定义一个自定义类型,这是SHFileOperation函数所需要的参数
Public Type SHFILEOPSTRUCT
�hwnd As Long
�wFunc As Long '指定操作名称
�pFrom As String '指定操作文件的文件名
�pTo As String
�fFlags As Integer '指定操作选项
�fAnyOperationsAborted As Long
�hNameMappings As Long
�lpszProgressTitle As Long
End Type

Public Const FO_DELETE = &H3 '删除文件
Public Const FOF_ALLOWUNDO = &H40 '允许撤销(即不完全删除,而是移到回收站)

Dim SHop As SHFILEOPSTRUCT
Dim strFile as string

'设置参数
With SHop
�.wFunc = FO_DELETE '设置操作为"删除文件"
�.pFrom = strFile + Chr(0) '设置应用操作的文件名,以API本身的要求,该参数需以Null(即Chr(0))结尾.
�.fFlags = FOF_ALLOWUNDO '这是选项为"允许撤销"(移到回收站)
End With

'执行操作
SHFileOperation SHop

回答2:

这个我也看不懂

知道是api的东西

每次都是复制的