Copy the SWF file in the IE temporary folder

xiaoxiao2021-03-06  89

'Copy the SWF file in the IE temporary folder, or other types of files, here is just simple demonstrations with FSO traversal folder' reference Microsoft Scripting runtim m_objfso as new filesistemObject 'Definition file system object

Private Declare Function SHGetSpecialFolderLocation Lib "Shell32" (ByVal hwndOwner As Long, ByVal nFolder As Integer, ppidl As Long) As LongPrivate Declare Function SHGetPathFromIDList Lib "Shell32" Alias ​​"SHGetPathFromIDListA" (ByVal pidl As Long, ByVal szPath As String) As LongConst MAX_LEN = 200 'String Maximum length const pageTMP = & H20 &' web page temporary file

PRIVATE SUB Command1_Click () DIM STMP AS STRING * MAX_LEN 'Storage Results String DIM NLENGTH AS Long' Strings DIM PIDL AS LONG 'A Special Directory in Special Directory List in Special Contents DIM TSTR AS STRING' Get web temporary folder ShgetSpecialFolderLocation 0, PageTmp, PIDL SHGETPATHFROMIDLIST PIDL, STMP TSTR = Left (stmp, instr (stmp, chr (0)) - 1) SearchSwf TSTREND SUB

Private Sub SearchSwf (strPath As String) Dim objFolder As Scripting.Folder 'folder object Dim objFile As Scripting.File' file object Dim objSubdirs As Scripting.Folders 'folder collection object Dim objLoopFolder As Scripting.Folder' Folder Object Set objFolder = m_objfso.getfolder (STRPATH) for Each Objfile IN ObjFolder.Files IF Ucase $ (Right $ (Objfile.shortpath, 4)) = ".swf" the filecopy objfile.path, "c: / testswf /" & objfile.name End If Next objFile Set objSubdirs = objFolder.SubFolders For Each objLoopFolder In objSubdirs SearchSwf objLoopFolder.Path Next objLoopFolder Set objSubdirs = Nothing Set objFolder = NothingEnd Sub

转载请注明原文地址:https://www.9cbs.com/read-102075.html

New Post(0)