Empty the recycle bin (Views: 705)
Problem/Question/Abstract: How to empty the recycle bin Answer: procedure EmptyRecycleBin; const SHERB_NOCONFIRMATION = $00000001; SHERB_NOPROGRESSUI = $00000002; SHERB_NOSOUND = $00000004; type TSHEmptyRecycleBin = function(Wnd: HWND; pszRootPath: pChar; dwFlags: DWORD): HRESULT; stdcall; var SHEmptyRecycleBin: TSHEmptyRecycleBin; LibHandle: THandle; begin LibHandle := LoadLibrary(pChar('Shell32.dll')); if LibHandle <> 0 then @SHEmptyRecycleBin := GetProcAddress(LibHandle, 'SHEmptyRecycleBinA'); if @SHEmptyRecycleBin <> nil then begin SHEmptyRecycleBin(Application.Handle, nil, SHERB_NOCONFIRMATION or SHERB_NOPROGRESSUI or SHERB_NOSOUND); end; FreeLibrary(LibHandle); @SHEmptyRecycleBin := nil; end; |