Results 1 to 2 of 2

Thread: How do I use the explorer copy function?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    Lincolnshire, UK
    Posts
    111

    Post

    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

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Try this:


    Code:
    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
    [email protected]
    [email protected]
    ICQ#: 51055819



    [This message has been edited by Serge (edited 11-12-1999).]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width