Empty Recycle bin - VB.NET code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vighnesh

    #1

    Empty Recycle bin - VB.NET code

    Hi All

    Can Anybody Please help me in how to Empty a Recycle bin using VB.NET code ?

    Regards
    Vighneswar


  • Jared Parsons [MSFT]

    #2
    Re: Empty Recycle bin - VB.NET code

    Hello vighnesh,
    Hi All
    >
    Can Anybody Please help me in how to Empty a Recycle bin using VB.NET
    code ?
    I believe that you need to P/Invoke for this functionality. Good news is
    that there is a sample up on Pinvoke.net to do this very thing.




    --
    Jared Parsons [MSFT]
    jaredpar@online .microsoft.com
    All opinions are my own. All content is provided "AS IS" with no warranties,
    and confers no rights.


    Comment

    • Peter

      #3
      Re: Empty Recycle bin - VB.NET code

      This is how you do it:

      Private Declare Function SHEmptyRecycleB in Lib "shell32.dl l" Alias
      "SHEmptyRecycle BinA" (ByVal hWnd As Int32, ByVal pszRootPath As String,
      ByVal dwFlags As Int32) As Int32
      Private Declare Function SHUpdateRecycle BinIcon Lib "shell32.dl l" () As
      Int32

      Private Const SHERB_NOCONFIRM ATION = &H1
      Private Const SHERB_NOPROGRES SUI = &H2
      Private Const SHERB_NOSOUND = &H4

      #Region "Empty Recycle Bin (SUB)"

      Private Sub EmptyRecycleBin ()
      SHEmptyRecycleB in(Me.Handle.To Int32, vbNullString, SHERB_NOCONFIRM ATION +
      SHERB_NOSOUND)
      SHUpdateRecycle BinIcon()
      End Sub

      #End Region

      I hope this helps,

      Crouchie1998
      MCP MCSE
      "vighnesh" <vighnesh@nanna computers.comwr ote in message
      news:enD3rWeoGH A.3452@TK2MSFTN GP05.phx.gbl...
      Hi All
      >
      Can Anybody Please help me in how to Empty a Recycle bin using VB.NET code
      ?
      >
      Regards
      Vighneswar
      >
      >

      Comment

      Working...