Mega Code Archive

 
Categories / Delphi / System
 

How to show the windows recycle bin

Title: How to show the windows recycle bin uses ActiveX, ShlObj, ShellApi; procedure FreePidl(pidl: PItemIDList); var allocator: IMalloc; begin if Succeeded(shlobj.SHGetMalloc(allocator)) then begin allocator.Free(pidl); {$IFDEF VER90} allocator.Release; {$ENDIF} end; end; procedure TForm1.Button1Click(Sender: TObject); var exInfo: TShellExecuteInfo; begin // initialize all fields to 0 FillChar(exInfo, SizeOf(exInfo), 0); with exInfo do begin cbSize := SizeOf(exInfo); // required! fMask := SEE_MASK_FLAG_DDEWAIT or SEE_MASK_IDLIST; Wnd := Handle; nShow := SW_SHOWNORMAL; lpVerb := 'open'; ShGetSpecialFolderLocation(Handle, CSIDL_BITBUCKET, PItemIDLIst(lpIDList)); end; ShellExecuteEx(@exInfo); FreePIDL(exinfo.lpIDList); end;