当前位置:雨林木风下载站 > 技术开发教程 > 详细页面

如何清空回收站

如何清空回收站

更新时间:2022-05-16 文章作者:未知 信息来源:网络 阅读次数:

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;  { EmptyRecycleBin } 

温馨提示:喜欢本站的话,请收藏一下本站!

本类教程下载

系统下载排行