请问清空回收站这条命令“SHEmptyRecycleBin()”怎么用,help没有啊。(50分)

  • 主题发起人 主题发起人 sakura12
  • 开始时间 开始时间
S

sakura12

Unregistered / Unconfirmed
GUEST, unregistred user!
[:(]请问清空回收站这条命令“SHEmptyRecycleBin()”怎么用,help没有啊。
 
SHEmptyRecycleBin<br><br><br>Empties the Recycle Bin on the specified drive. <br><br>HRESULT SHEmptyRecycleBin(<br>&nbsp; &nbsp; HWND hwnd, <br>&nbsp; &nbsp; LPCTSTR pszRootPath, <br>&nbsp; &nbsp; DWORD dwFlags<br>);<br><br>Parameters<br>hwnd <br>Handle to the parent window of any dialog boxes that might be displayed during the operation. This parameter can be NULL. <br>pszRootPath <br>Address of a NULL-terminated string that contains the path of the root drive on which the Recycle Bin is located. This parameter can contain the address of a string formatted with the drive, folder, and subfolder names (c:/windows/system . . .). It can also contain an empty string or NULL. If this value is an empty string or NULL, all Recycle Bins on all drives will be emptied. <br>dwFlags <br>One or more of the following values: SHERB_NOCONFIRMATION &nbsp;No dialog confirming the deletion of the objects will be displayed. &nbsp;<br>SHERB_NOPROGRESSUI &nbsp;No dialog indicating the progress will be displayed. &nbsp;<br>SHERB_NOSOUND &nbsp;No sound will be played when the operation is complete. &nbsp;<br><br>Return Values<br>Returns S_OK if successful, or an OLE-defined error value otherwise. <br><br>See Also<br>SHQueryRecycleBin <br><br>Requirements <br>&nbsp; Version 4.71 and later of Shell32.dll<br><br>&nbsp; Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later). <br>&nbsp; Windows 95/98: Requires Windows 98 (or Windows 95 with Internet Explorer 4.0 or later). <br>&nbsp; Header: Declared in shellapi.h. <br>&nbsp; Import Library: shell32.lib.<br>
 
如何清空回收站<br><br>Procedure EmptyRecycleBin ;<br>&nbsp; Const<br>&nbsp; &nbsp; SHERB_NOCONFIRMATION = $00000001 ;<br>&nbsp; &nbsp; SHERB_NOPROGRESSUI &nbsp; = $00000002 ;<br>&nbsp; &nbsp; SHERB_NOSOUND &nbsp; &nbsp; &nbsp; &nbsp;= $00000004 ;<br><br>&nbsp; Type<br>&nbsp; &nbsp; TSHEmptyRecycleBin = function (Wnd &nbsp; &nbsp; : HWND &nbsp;;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LPCTSTR : PChar ;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DWORD &nbsp; : Word &nbsp; ) : Integer ; stdcall ;<br>&nbsp; Var<br>&nbsp; &nbsp; SHEmptyRecycleBin : TSHEmptyRecycleBin ;<br>&nbsp; &nbsp; LibHandle &nbsp; &nbsp; &nbsp; &nbsp; : THandle &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;<br><br>&nbsp; Begin &nbsp;<br>&nbsp; &nbsp; LibHandle := LoadLibrary(PChar('Shell32.dll')) ;<br>&nbsp; &nbsp; If LibHandle &lt;&gt; 0 then<br>&nbsp; &nbsp; &nbsp; @SHEmptyRecycleBin := GetProcAddress(LibHandle, 'SHEmptyRecycleBinA')<br>&nbsp; &nbsp; Else<br>&nbsp; &nbsp; &nbsp; Begin<br>&nbsp; &nbsp; &nbsp; &nbsp; MessageDlg('Failed to load Shell32.dll.', mtError, [mbOK], 0);<br>&nbsp; &nbsp; &nbsp; &nbsp; Exit ;<br>&nbsp; &nbsp; &nbsp; End ;<br><br>&nbsp; &nbsp; If @SHEmptyRecycleBin &lt;&gt; nil then<br>&nbsp; &nbsp; &nbsp; SHEmptyRecycleBin(Application.Handle &nbsp; &nbsp; &nbsp;,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; '' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SHERB_NOCONFIRMATION or<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SHERB_NOPROGRESSUI &nbsp; or<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SHERB_NOSOUND &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;) ;<br>&nbsp; &nbsp; FreeLibrary(LibHandle);<br>&nbsp; &nbsp; @SHEmptyRecycleBin := nil ;<br>&nbsp; End ;<br>
 
上面是vc之msdn中的说明,不过也可以用,底下可以参考新编windows api参考大全中关于delphi调用api函数的说明调用此函数即可,这本书在超星和国家图书馆中都有。用破解的超星图书阅览器和国家图书馆图书下载器可以下载,好书还是比较多的
 
不好意思,忘了看说明,忘了换行
 
接受答案了.
 
后退
顶部