windows shell api SHEmptyRecycleBin 清空回收站

时间:2023-03-09 21:42:19
windows shell api SHEmptyRecycleBin 清空回收站

HRESULT SHEmptyRecycleBin(

HWND hwnd,

LPCTSTR pszRootPath,

DWORD dwFlags );

hwnd

父窗口句柄

pszRootPath

将要清空的回收站的驱动器地址,如果为NULL,则清空所有驱动器上的回收站。

dwFlags

可以用|操作符同时选择下列一个或多个值。

SHERB_NOCONFIRMATION 不显示任何确认删除对象的对话框。

SHERB_NOPROGRESSUI 不显示任何指示其进度的对话框。

SHERB_NOSOUND 当操作完成无声音提示。

示例代码:

 #include <Windows.h>
#include <ShellAPI.h> int main()
{
SHEmptyRecycleBin(NULL,NULL,SHERB_NOCONFIRMATION|SHERB_NOPROGRESSUI|SHERB_NOSOUND);
return ;
}