I'm using SHFileOperation to delete files to Recycle bin. But sometimes I received a "System call level is not correct" error. It not happens every time or every file. Just some random files at random time. Anyone knows the reason? Thanks.
Update: Here it the code I am using:
function DeleteToRecycleBin(const ADir : WideString) : Integer;
var
op : SHFILEOPSTRUCTW;
begin
ZeroMemory(@op, sizeof(op));
op.pFrom := PWideChar(ADir + #0#0);
op.wFunc := FO_DELETE;
op.fFlags := FOF_SILENT or FOF_NOCONFIRMATION or FOF_NOERRORUI or FOF_ALLOWUNDO;
Result := SHFileOperationW(op);
end;
You are receiving error code 124 (0x7C). Win32 error code 124 is
ERROR_INVALID_LEVEL. However, if you read the documentation forSHFileOperation(), some of its error codes pre-date Win32 and thus do not have the same meaning as the same Win32 error codes. Error code 124 is one of those values. In the context ofSHFileOperation(), error 124 actually means:Update: try this: