Smazßnφ soubor∙ v koÜi

Postup:
V modulu deklarujte:

Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias _
"SHEmptyRecycleBinA" (ByVal hWnd As Long, ByVal pszRootPath _
As String, ByVal dwFlags As Long) As Long 

Const SHERB_NOCONFIRMATION = &H1 
Const SHERB_NOPROGRESSUI = &H2 
Const SHERB_NOSOUND = &H4 

' Sma₧e vÜechny soubory Recycle Binu.  
' Je-li RootPath null string, sma₧e soubory v Recycle Binech 
' na vÜech discφch. Lze vypnout potvrzovacφ dialog, 
' indikßtor pr∙b∞hu a zvuky
 

Sub EmptyRecycleBin(ByVal RootPath As String, Optional _
NoConfirmation As  Boolean, Optional NoProgress As Boolean, _
Optional NoSound As Boolean) 

   Dim hWnd As Long, flags As Long 

   On Error Resume Next 
   hWnd = Screen.ActiveForm.hWnd 

   If Len(RootPath) > 0 And Mid$(RootPath, 2, 2) <> ":\" Then 
      RootPath = Left$(RootPath, 1) & ":\" 
   End If 

   flags = (NoConfirmation And SHERB_NOCONFIRMATION) Or _
   (NoProgress And SHERB_NOPROGRESSUI) Or (NoSound _
   And SHERB_NOSOUND) 

   SHEmptyRecycleBin hWnd, RootPath, flags 

End Sub

Zp∞t

Autor: The Bozena