Click to See Complete Forum and Search --> : How do I use the explorer copy function?
chrisfricke
Nov 11th, 1999, 09:01 PM
I'm fairly sure that there is a way to use windows explorer's file copy function (it might be called something different), but I don't know how. Can anyone help?
If not, does anyone know how I can copy a file from a network UNC to a local disk and show either a progress bar or similar while it's doing this?
Cheers
Chris
Serge
Nov 12th, 1999, 01:16 AM
Try this:
Const FO_COPY = &H2
Private Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAborted As Boolean
hNameMaps As Long
sProgress As String
End Type
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Public Sub CopyFileProgress(pFileFrom As String, pFileTo As String, Optional pShowProgress As Boolean = True)
Dim structFO As SHFILEOPSTRUCT
Dim lRet As Long
With structFO
.wFunc = FO_COPY
.pFrom = pFileFrom & vbNullChar & vbNullChar
.pTo = pFileTo & vbNullChar & vbNullChar
.fFlags = 0
End With
lRet = SHFileOperation(structFO)
End Sub
Usage: CopyFileProgress FileFrom, FileTo
Sample: CopyFileProgress "\\ComputerName\D\MyFile.txt", "C:\MyFile.txt"
Regards,
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
[This message has been edited by Serge (edited 11-12-1999).]
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.