Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

EmptyRecycleBin - Delete all files in the Recycle Bin
[ All Languages » VB »  Windows]

Total Hit ( 1983)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Click here to copy the following block
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

' Empty all the files in the Recycle Bin.
'
' If RootPath is a null string, it affects the Recycle Bin
' of all drives. You can optionally turn off confirmation dialogs,
' progress dialog, and sounds

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

  ' get the handle of the active window, or zero
  On Error Resume Next
  hWnd = Screen.ActiveForm.hWnd
  ' add a colon and backslash, if missing
  If Len(RootPath) > 0 And Mid$(RootPath, 2, 2) <> ":\" Then
    RootPath = Left$(RootPath, 1) & ":\"
  End If
  ' build the flags argument
  flags = (NoConfirmation And SHERB_NOCONFIRMATION) Or (NoProgress And _
    SHERB_NOPROGRESSUI) Or (NoSound And SHERB_NOSOUND)
  SHEmptyRecycleBin hWnd, RootPath, flags
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.