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

Show the contents of the Recycle Bin folder
[ All Languages » VB »  Windows]

Total Hit ( 1948)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


You can use the ShellExecute API function to programmatically open a window of Explorer and display the contents of the Recycle Bin. This is the function's declare:

Click here to copy the following block
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
  (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
  ByVal lpParameters As String, ByVal lpDirectory As String, _
  ByVal nShowCmd As Long) As Long

The first parameter is the handle of parent window, the second is the action to be peerformed (in our case is "open"), the third argument is the application to execute, the fourth is the command line for the application, the fifth is the default directory. The last specifies the style of the window (maximized, normal or minimized), and you can use the same constants accepted by VB's Shell function. As you see in the following code, the trick is to specify the special GUID of the Recicly Bin in the command string passed to Explorer:

Click here to copy the following block
Private Sub cmdShowRecycleBin_Click()
  ShellExecute 0, "Open", "explorer.exe", _
    "/root,::{645FF040-5081-101B-9F08-00AA002F954E}", 0&, vbNormalFocus
End Sub

The user can then select the Empty Recycle Bin command from the File menu to manually empty the Recycle Bin, if desired.



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.