fix #1456 Error when empty recycle bin

This commit is contained in:
jhdxr
2018-12-22 14:23:28 +08:00
parent d9fe2e0974
commit d458500113

View File

@@ -143,9 +143,10 @@ namespace Wox.Plugin.Sys
Action = c =>
{
// http://www.pinvoke.net/default.aspx/shell32/SHEmptyRecycleBin.html
// FYI, couldn't find documentation for this but if the recycle bin is already empty, it will return -2147418113 (0x8000FFFF (E_UNEXPECTED))
// 0 for nothing
var result = SHEmptyRecycleBin(new WindowInteropHelper(Application.Current.MainWindow).Handle, 0);
if (result != (uint) HRESULT.S_OK)
if (result != (uint) HRESULT.S_OK && result != (uint)0x8000FFFF)
{
MessageBox.Show($"Error emptying recycle bin, error code: {result}\n" +
"please refer to https://msdn.microsoft.com/en-us/library/windows/desktop/aa378137",