Results 1 to 2 of 2

Thread: SHFILEOPSTRUCT problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Location
    Sligo, Ireland
    Posts
    15

    SHFILEOPSTRUCT problem

    I am using this api to copy files from one location to another
    However if the files already exist in the destination location I want the program to ask me if it is ok to overwrite the existing files
    I have read all about the different flags used with this api but I can find nothing about overwrittihg files

    can this be done


    code
    Dim fos As SHFILEOPSTRUCT
    Dim sa(1 To 32) As Byte
    Dim retval As Long

    With fos

    .hWnd = Form1.hWnd

    .wFunc = FO_COPY

    .pFrom = C:\test\*.* & vbNullChar & vbNullChar

    .pTo = C:\temp & vbNullChar & vbNullChar

    .fFlags = FOF_SIMPLEPROGRESS Or FOF_ALLOWUNDO

    .fAnyOperationsAborted = 0
    .hNameMappings = 0

    End With

    CopyMemory sa(1), fos, LenB(fos)
    CopyMemory sa(19), sa(21), 12


    retval = SHFileOperation(sa(1))


    CopyMemory sa(21), sa(19), 12
    CopyMemory fos, sa(1), Len(fos)

    Thanks for your time

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    How about running code, before your copy operation, to check to see if the file exists? If it does, then before you call your copy operation, popup a message verifying the copy.

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