本文整理自网络,侵删。
delphi清空回收站
Procedure EmptyRecycleBin;
Const
SHERB_NOCONFIRMATION = $00000001 ;
SHERB_NOPROGRESSUI = $00000002 ;
SHERB_NOSOUND = $00000004 ;
Type
TSHEmptyRecycleBin = function (Wnd : HWND ;
LPCTSTR : PChar ;
DWORD : Word ) : Integer ; stdcall ;
Var
SHEmptyRecycleBin : TSHEmptyRecycleBin ;
LibHandle : THandle ;
Begin
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 ,
'' ,
SHERB_NOCONFIRMATION or
SHERB_NOPROGRESSUI or
SHERB_NOSOUND ) ;
FreeLibrary(LibHandle);
@SHEmptyRecycleBin := nil ;
End ;
相关阅读 >>
Delphi xe增强的rtti妙用--动态创建包中的窗口类
更多相关阅读请进入《Delphi》频道 >>