I'm using SHFileOperation to copy a folder from one location to another. Here is my code:

VB Code:
  1. Dim SHFileOp As SHFILEOPSTRUCT  
  2. Dim lngSuccess As Long          
  3.    
  4.    
  5.     With SHFileOp
  6.         .hwnd = 0
  7.         .wFunc = FO_COPY
  8.         .pFrom = strSource
  9.         .pTo = strTarget
  10.         .lpszProgressTitle = "Please wait, backing up..."
  11.         .fFlags = FOF_NOERRORUI
  12.     End With
  13.    
  14.     lngSuccess = SHFileOperation(SHFileOp)
  15.              
  16.     If SHFileOp.fAnyOperationsAborted Then
  17.           'Handle abort
  18.     End If
  19.  
  20.     Select Case lngSuccess
  21.            'Handle errors
  22.     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?