Even worse: Any one know how to keep SHFileOperation from popping up the confirmation dialog ?? I know it's a flag of some sort but can't find it.

VB Code:
  1. 'In general section
  2. Private Declare Function CreateDirectory Lib "kernel32" Alias "CreateDirectoryA" (ByVal lpPathName As String, lpSecurityAttributes As SECURITY_ATTRIBUTES) As Long
  3. Private Type SECURITY_ATTRIBUTES
  4.     nLength As Long
  5.     lpSecurityDescriptor As Long
  6.     bInheritHandle As Long
  7. End Type
  8. Private Type SHFILEOPSTRUCT
  9.     hWnd As Long
  10.     wFunc As Long
  11.     pFrom As String
  12.     pTo As String
  13.     fFlags As Integer
  14.     fAborted As Boolean
  15.     hNameMaps As Long
  16.     sProgress As String
  17. End Type
  18. Private Const FO_DELETE = &H3
  19. Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
  20. Private Sub Command1_Click()
  21.     If FolderExist("c:\bob") = True Then
  22.         MsgBox "it's there"
  23.     Else
  24.         MsgBox "Boo-Hoo"
  25.     End If
  26. End Sub
  27.  
  28. Public Function FolderExist(sFolderPath) As Boolean
  29.     'KPD-Team 1998
  30.     'URL: [url]http://www.allapi.net/[/url]
  31.     'E-Mail: [email][email protected][/email]
  32.     Dim Security As SECURITY_ATTRIBUTES
  33.     'Create a directory
  34.     Ret& = CreateDirectory(sFolderPath, Security)
  35.     'If CreateDirectory returns 0, the function has failed
  36.     If Ret& = 0 Then
  37.         FolderExist = True
  38.     Else
  39.         Dim SHDirOp As SHFILEOPSTRUCT
  40.         With SHDirOp
  41.             .wFunc = FO_DELETE
  42.             .pFrom = sFolderPath
  43.         End With
  44.         'Delete the directory
  45.         SHFileOperation SHDirOp
  46.        
  47.         FolderExist = False
  48.     End If
  49. End Function