From: Martin Thorsten Heintze To: Earl F. Glynn Subject: Re: Empty Recycle Bin from Delphi (4) ?? Date: Saturday, June 12, 1999 10:56 AM > Can you believe the SHEmptyRecycleBin API call? > > Try this link to a Deja News post for sample code: > www.efg2.com/Lab/Library/UseNet/0430c.txt [updated, March 2001, efg] Thank You!!! After some try-and-error I found out the following: SHEmptyRecycleBin: SHSTDAPI SHEmptyRecycleBin( HWND hwnd, LPCTSTR pszRootPath, DWORD dwFlags ); Empties the recycle bin on the specified drive. Returns S_OK if successful, or an OLE-defined error value otherwise. hwnd Handle to the parent window of any dialog boxes that might be displayed during the operation. This parameter can be NULL. pszRootPath Address of a NULL-terminated string that contains the path of the root drive on which the recycle bin is located. This parameter can contain the address of a string formatted with the drive, folder, and subfolder names (c:\windows\system . . .). It can also contain an empty string or NULL. If this value is an empty string or NULL, all recycle bins on all drives will be emptied. dwFlags One or more of the following values: SHERB_NOCONFIRMATION No dialog confirming the deletion of the objects will be displayed. SHERB_NOPROGRESSUI No dialog indicating the progress will be displayed. SHERB_NOSOUND No sound will be played when the operation is complete. example: unit test; interface uses Windows; const // dwFlags : DWORD; SHERB_NOCONFIRMATION = $0001; SHERB_NOPROGRESSUI = $0002; SHERB_NOSOUND = $0004; function EmptyRecycleBin ( Handle : HWND; RootPath : LPCTSTR; dwFlags : DWORD ) : Integer; implementation // External declarations function SHEmptyRecycleBinA ( hWnd : HWND; Path : LPCTSTR; dwFlags : DWORD ) : longint; stdcall; external 'shell32.dll'; function EmptyRecycleBin ( Handle : HWND; RootPath : LPCTSTR; dwFlags : DWORD ) : Integer; begin EmptyRecycleBin := SHEmptyRecycleBinA ( Handle, RootPath, dwFlags ); end; end.