Results 1 to 3 of 3

Thread: Empty Recycle bin by VB

  1. #1

    Thread Starter
    New Member hanysaad's Avatar
    Join Date
    Jan 2006
    Location
    Egypt , Asyut
    Posts
    5

    Lightbulb Empty Recycle bin by VB

    Code to Empty Recycle bin by VB
    VB Code:
    1. Const SHERB_NOCONFIRMATION = &H1
    2. Const SHERB_NOPROGRESSUI = &H2
    3. Const SHERB_NOSOUND = &H4
    4. Private Type ULARGE_INTEGER
    5.   LowPart As Long
    6.   HighPart As Long
    7. End Type
    8. Private Type SHQUERYRBINFO
    9.   cbSize As Long
    10.   i64Size As ULARGE_INTEGER
    11.   i64NumItems As ULARGE_INTEGER
    12. End Type
    13. Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias "SHEmptyRecycleBinA" (ByVal hwnd As Long, ByVal pszRootPath As String, ByVal dwFlags As Long) As Long
    14. Private Declare Function SHUpdateRecycleBinIcon Lib "shell32.dll" () As Long
    15. Private Declare Function SHQueryRecycleBin Lib "shell32.dll" Alias "SHQueryRecycleBinA" (ByVal pszRootPath As String, pSHQueryRBInfo As SHQUERYRBINFO) As Long
    16. Private Sub Form_Load()
    17.        Dim RBinInfo As SHQUERYRBINFO, Msg As VbMsgBoxResult
    18.     RBinInfo.cbSize = Len(RBinInfo)
    19.     SHQueryRecycleBin vbNullString, RBinInfo
    20.     If (RBinInfo.i64Size.LowPart And &H80000000) = &H80000000 Or RBinInfo.i64Size.HighPart > 0 Then
    21.         Msg = MsgBox("Your Recycle Bin consumes over 2 gigabytes right now!" + vbCrLf + "Do you want to empty it?", vbYesNo + vbQuestion)
    22.     Else
    23.         Msg = MsgBox("Your Recycle Bin consumes" + Str$(RBinInfo.i64Size.LowPart) + " bytes right now." + vbCrLf + "Do you want to empty it?", vbYesNo + vbQuestion)
    24.     End If
    25.     If Msg = vbYes Then
    26.         SHEmptyRecycleBin Me.hwnd, vbNullString, 0
    27.         SHUpdateRecycleBinIcon
    28.     End If
    29. End Sub
    "THERE IS NO GOD EXCEPT ALLAH, AND MUHAMMED IS HIS MESSENGER "
    Hany Saad Moustaffa .
    Moderator of VB6.0 forum in Arabteam forums.
    Egypt, Asyut.
    Asyut university, faculty of science.
    E-mail : [email protected]
    My Blog : http://hanysaad.blogspot.com/

  2. #2
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Empty Recycle bin by VB

    If you are going to post working code, please post it in the VB Codebank
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  3. #3

    Thread Starter
    New Member hanysaad's Avatar
    Join Date
    Jan 2006
    Location
    Egypt , Asyut
    Posts
    5

    Arrow Re: Empty Recycle bin by VB

    If you are going to post working code, please post it in the VB Codebank
    I am sorry , i did not remark this code bank
    thank you for your remark,,,
    "THERE IS NO GOD EXCEPT ALLAH, AND MUHAMMED IS HIS MESSENGER "
    Hany Saad Moustaffa .
    Moderator of VB6.0 forum in Arabteam forums.
    Egypt, Asyut.
    Asyut university, faculty of science.
    E-mail : [email protected]
    My Blog : http://hanysaad.blogspot.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width