Mengosongkan recycle bin


Cara mengosongkan Recycle Bin dari Delphi bisa di buat dengan menggunakan Perintah di satu tombol TButton (Button1) masukan C0d3 Program dalam Properties Event OnClick. Berikut Contoh code Programnya :



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;

Bila Telah Selesai  RUN dengan Menekan F9 (Compiler) Project, Ok sekian Tutorial Delphinya Selamat Mencoba.  ^_^

Leave a Reply

Silahkan Tulis Komentar Anda, Sopan dan Berwibawa