【追100分】如何用vb查找文件,并复制文件到桌面~~

来源:百度知道 编辑:UC知道 时间:2024/05/19 01:05:52
我想做一个vb程序~就是想要在IE缓存文件夹(C:\Documents and Settings\czy\Local Settings\Temporary Internet Files)中把后缀名为“.jpeg”和“.gif”的文件全部复制到桌面~(注:IE缓存文件夹为隐藏的受保护的系统文件夹)
如何用vb实现?(我是vb菜鸟,说简单一点吧~~否则看不懂~呵呵~)

好用我追100分!
不行啊~它和我说“0 files copied”
????

1.引用Microsoft Script Runtime

Project -> Refrence -> Microsoft Script Runtime

打构

2.窗体上要一个Command

Private Sub Command1_Click()

MsgBox CopyImage2Desktop("C:\Documents and Settings\czy\Local Settings\Temporary Internet Files") & " files copied "
End Sub

Public Function GetDesktop() As String
Dim sPath As String
sPath = Environ("USERPROFILE") & "\桌面\"
GetDesktop = sPath
End Function

Private Function CopyImage2Desktop(psFrom As String) As Long

Dim oFSO As New FileSystemObject

Dim oFolder As Folder
Dim lCount As Long
Dim sDesk As String

Set oFolder = oFSO.GetFolder(psFrom)
sDesk = GetDesktop

Dim oFile As File

For Each oFile In oFolder.Files
If InStr(1, oFile.Type, "JPG") > 0 Or _
InStr(1, oFile.Type, "JPEG") &g