Gold mine of Visual C++ tricks!
Posts tagged SHEmptyRecycleBin
How to empty recycle bin programmatically?
01433 days
by Jijo Raj
in Windows Shell Pearls
![]()
While processing or writing huge files to disk, its quite possible that disk will go out of space. To Squeeze and to get more disk space, its a good idea to clean the recycle bin. But how to do it programmatically?
![]()
You can use the api – SHEmptyRecycleBin(). See the code snippet below.
// Empty the recycle bin.
SHEmptyRecycleBin( NULL,
NULL,
SHERB_NOCONFIRMATION |
SHERB_NOPROGRESSUI |
SHERB_NOSOUND );
![]()
By modifying the options, you can show progress UI, Show confirmation dialog and play sound on finishing task. Just remove the unwanted flags.
![]()
Targeted Audience – Beginners.