Author: Vimil Saju
How to get the number of files in recycle bin and the size of recycle bin
Answer:
To get the number files in the recycle bin, you have to use the function
SHQueryRecycleBin. this function is available in the shell32 module. This function
is supported in Win98 or above.
The function declarartion is as shown below
1 2 function SHQueryRecycleBin(pszrtootpath: pchar; QUERYRBINFO: pshqueryrbinfo):
3 integer;
4 stdcall;
5 external 'shell32' name 'SHQueryRecycleBinA';
The SHQUERYBINFO Structure is as follows
6 type7 SHQUERYRBINFO = packedrecord8 cbSize: integer; // size of structure9 i64Size: int64; // size of recycle bin10 i64NumItems: int64; // number of items in recycle bin.11 end;
The cbsize must be set before calling the function
The first parameter must be the drive of which the recyclebin must be queried.
If the drive 'C' then the parameter must be'C:\'; if the parameter is empty then
the function queries the recyclebin on all the harddisks as a whole.
the second parameter is a pointer to SHQUERYBINFO Structure.
The function returns 0 if successful.
The function can be called as follows
12 var13 rbinfo: SHQUERYRBINFO;
14 begin15 SHQueryRecycleBin('C:\', @rbinfo);
16 end;