From: "Bernd Ua" Subject: Re: How to Empty Recycle Bin? Date: 30 Apr 1999 00:00:00 GMT Message-ID: <7gcgv0$qi518@forums.borland.com> References: <7g9mt1$o792@forums.borland.com> <7g9q3c$o7a7@forums.borland.com> <7gc8fe$qj85@forums.borland.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: Software-Haus Brumund GmbH Newsgroups: borland.public.delphi.winapi Nearly everything looked right, it's my fault, not to mention that function might be exported as 'SHEmptyRecycleBinA' or 'SHEmptyRecycleBinW' These functions have usually two versions one works with PChars the otherone with wide chars. If you have source ( Prof. version and up look into source of ShellApi for further examples, nevertheless i tested the following some seconds ago and it works : unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, ShellApi,Controls, Forms, Dialogs,StdCtrls, ExtCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); end; var Form1: TForm1; function SHEmptyRecycleBin (Wnd:HWnd; LPCTSTR:PChar; DWORD:Word):Integer; stdcall; const SHERB_NOCONFIRMATION = $00000001; SHERB_NOPROGRESSUI = $00000002; SHERB_NOSOUND = $00000004; implementation {$R *.DFM} function SHEmptyRecycleBin; external 'SHELL32.DLL' name 'SHEmptyRecycleBinA'; procedure TForm1.Button1Click(Sender: TObject); begin SHEmptyRecycleBin(self.handle,'',SHERB_NOCONFIRMATION); end; end. My RecycleBin is really empty now. Another point to mention is, think twice before doing an import via external. If you program is started on a machine with an older version of shell-dll the same message you encountered will pop up nothing more from your program. Think about loading this procedure dynamic with LoadLibrary/GetProcAdress depending on the Shell version. HTH Bernd -- Bernd Ua - Software-Haus Brumund GmbH ua@nospambrumund.de // to reply, remove nospam from email adress :-) // obviously this needs to be stated, too : please no unsolicited private email unless explicitly invited