whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

100 Visitors Online


 
...empty recycle bin?
Autor: Simon Grossenbacher
Homepage: http://www.swissdelphicenter.ch
[ Print tip ]  

Tip Rating (4):  
     


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  { EmptyRecycleBin }
  
LibHandle := LoadLibrary(PChar('Shell32.dll'));
  if LibHandle <> 0 then @SHEmptyRecycleBin :=
      GetProcAddress(LibHandle, 'SHEmptyRecycleBinA')
  else
  begin
    
MessageDlg('Failed to load Shell32.dll.', mtError, [mbOK], 0);
    Exit;
  end;

  if @SHEmptyRecycleBin <> nil then
    
SHEmptyRecycleBin(Application.Handle,
                      nil,
                      SHERB_NOCONFIRMATION or SHERB_NOPROGRESSUI or SHERB_NOSOUND);
  FreeLibrary(LibHandle); @SHEmptyRecycleBin := nil;
end;



procedure TForm1.Button1Click(Sender: TObject);
begin
  
EmptyRecycleBin;
end;


{
 Minimum operating systems: Windows XP/2000, Windows NT 4.0 with Internet Explorer 4.0,
                            Windows 98, Windows 95 with Internet Explorer 4.0
 (shell32.dll version 4.71 or later)
}

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners