I'm using SHFileOperation to copy a folder from one location to another. Here is my code:
VB Code:
Dim SHFileOp As SHFILEOPSTRUCT Dim lngSuccess As Long With SHFileOp .hwnd = 0 .wFunc = FO_COPY .pFrom = strSource .pTo = strTarget .lpszProgressTitle = "Please wait, backing up..." .fFlags = FOF_NOERRORUI End With lngSuccess = SHFileOperation(SHFileOp) If SHFileOp.fAnyOperationsAborted Then 'Handle abort End If Select Case lngSuccess 'Handle errors End Select
If all goes well, everything works fine. But I'm having problems with trying to handle the errors it produces. For some reason, I get the same error code (lngSuccess = 117) when I either cancel the file copy or when a file in the directory being copied is currently open. I want to handle these two cases differently, though. I've tried using fAnyOperationsAborted and fAborted but they don't differentiate between the two cases either.
Any ideas?


Reply With Quote