Advertisement
5_2007-2008 Files/ File Controls/ Input/ Output #172923

VB Takes Out The Trash

Empties the Recycle Bin, regardless of what drive/folder assigned to.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
' ShellTrash Demo
' by Barry L. Camp (blcamp@yahoo.com)
Option Explicit ' The Author's preference.
Const SHERB_NOCONFIRMATION = &H1& ' No dialog confirming the deletion of the objects will be displayed.
Const SHERB_NOPROGRESSUI = &H2& ' No dialog indicating the progress will be displayed.
Const SHERB_NOSOUND = &H4& ' No sound will be played when the operation is complete.
Private Declare Function SHEmptyRecycleBin Lib "shell32" Alias "SHEmptyRecycleBinA" _
 (ByVal hWnd As Long, ByVal lpBuffer As String, ByVal dwFlags As Long) As Long
Sub Main()
 Dim rc As Long
 Dim nFlags As Long
 ' Suppresses all UI elements, for "quiet" operation.
 nFlags = SHERB_NOCONFIRMATION Or SHERB_NOPROGRESSUI Or SHERB_NOSOUND
 rc = SHEmptyRecycleBin(0&, vbNullString, nFlags)
End Sub

<SCRIPT LANGUAGE="JavaScript">
function CreateArray(dim1) {
	if (CreateArray.arguments.length == 1) {
		return new Array(dim1);
	} else {
		var multiArray = new Array(dim1)
		for (var i = 0; i < dim1; i++) {
			multiArray[i] = new Array(CreateArray.arguments[1]);
		}
		return multiArray;
	}
}
//Create a one-dimensional array
var myArray = CreateArray(5);
//Create a two-dimensional array
var myArray = CreateArray(5,2);
//Looping through the two-dimensional array
for (var i = 0; i <= myArray.length-1; i++) {
	for (var j = 0; j < myArray[i].length; j++) {
		// alert(myArray[i][j]);
	}
}
</SCRIPT>

Upload
Original Comments (3)
Recovered from Wayback Machine