Bruno
Wed May 30 09:12:12 CDT 2007
>> I need to empty the recycle bin in a windows service program, and
>> the SHEmptyRecycleBin(NULL, NULL, SHERB_NOCONFIRMATION |
>> SHERB_NOPROGRESSUI | SHERB_NOSOUND) cannot realize it.
>
> How do you mean "cannot realize it"? Nothing happens? It fails? If so,
> with what error code?
>
> I would assume that every user has their own recycle bin, and you cannot
> empty another user's recycle bin without jumping through some hoops.
> Your service is probably not running as the interactive user.
Interactive user is not the first problem (if it is a problem at all).
Each user has it's own recycle bin, and a service is running with local
system privileges by default.
You can run as a specific user but then you can only empty the recycle bin
of that user.
You could use impersonation, and then empty the recycle bin and revert to
self afterwards.
--
Kind regards,
Bruno van Dooren MVP - VC++
http://msmvps.com/blogs/vanDooren
bruno_nos_pam_van_dooren@hotmail.com