如何清空回收站_Delphi

  • 内容
  • 评论
  • 相关

Procedure EmptyRecycleBin ;
Const
  SHERB_NOCONFIRMATION = $00000001 ;
  SHERB_NOPROGRESSUI   = $00000002 ;
  SHERB_NOSOUND        = $00000004 ;
Type
  TSHEmptyRecycleBin = function (Wnd : HWND;  
                                 pszRootPath : PChar;  
                                 dwFlags : DWORD
                       ) : HRESULT; stdcall ;

http://www.gaodaima.com/?p=65873如何清空回收站_Delphi

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 } 

欢迎大家阅读《如何清空回收站_Delphi》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码

原创文章,转载请注明: 转载自搞代码

本文链接地址: 如何清空回收站_Delphi

微信支付二维码

微信 赏一包辣条吧~

支付宝支付二维码

支付宝 赏一听可乐吧~

评论

0条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注