Results 1 to 2 of 2

Thread: SHfileOperations finction

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 1999
    Location
    u.s.a
    Posts
    127
    I have 2 questions:
    1.
    I am currently using the SHfileOpration function to copy
    files from one directory to a nother.
    for some reason when I call the function twice (one call after the other) The progress dialog box does not appear the second time! (although the copying takes place)
    I tried DoEvents between the 2 calls but that didn't work
    Any suggestions?

    2.
    When I call the function with a FO_DELETE flag in the structure argument,the file does not move to the recycle bin.
    Is there a way of doing this?
    Tahnks.
    Dan.

  2. #2
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    1. My suggestion would have been to use DoEvents but seems that didn't work for you...so i can't help there.

    2. Try this out:
    Code:
    Public Type SHFILEOPSTRUCT
        hwnd As Long
        wFunc As Long
        pFrom As String
        pTo As String
        fFlags As Integer
        fAnyOperationsAborted As Long
        hNameMappings As Long
        lpszProgressTitle As Long
    End Type
    
    Public Declare Function SHFileOperation Lib _
    "shell32.dll" Alias "SHFileOperationA" (lpFileOp _
    As SHFILEOPSTRUCT) As Long
    
    Public Const FO_DELETE = &H3
    Public Const FOF_ALLOWUNDO = &H40
    
    'CODE
    Dim SHop As SHFILEOPSTRUCT
    Dim strFile as string
    strFile = "C:\windows\desktop\test.txt"
    With SHop
        .wFunc = FO_DELETE
        .pFrom = strFile
        .fFlags = FOF_ALLOWUNDO
    End With
    
    SHFileOperation SHop
    'Code take from vb-world tips and slightly modified.
    Hope that helps,
    D!m


    Dim

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