Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Enumerate recycle bin items
#1
what is the proper syntax for enumerating files in the recycle bin
i know u must use these functions but cannot sort of the proper syntax in qm
SHQueryRecycleBin SHQUERYRBINFO

was looking for an example
#2
Macro enumerate Recycle Bin
Code:
Copy      Help
out
IShellFolder sfD sfRB
ITEMIDLIST* pidlRB pidl
SHGetDesktopFolder(&sfD)
SHGetSpecialFolderLocation(0 CSIDL_BITBUCKET &pidlRB)
sfD.BindToObject(pidlRB 0 IID_IShellFolder &sfRB)
CoTaskMemFree pidlRB
IEnumIDList en
sfRB.EnumObjects(0 SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN &en)
rep
,en.Next(1 &pidl &_i); if(_hresult) break
,STRRET sr; sfRB.GetDisplayNameOf(pidl 0 &sr)
,word* w; StrRetToStrW(&sr pidl &w)
,str s.ansi(w)
,CoTaskMemFree w
,CoTaskMemFree pidl
,out s

http://www.codeproject.com/Articles/278 ... ecycle-Bin
#3
thank you works great Big Grin
#4
Dear Gintaras,

Is it possible to extend this useful example including each file's size?

Thanks
#5
Macro enumerate Recycle Bin
Code:
Copy      Help
out

IShellFolder2 sfD sfRB
ITEMIDLIST* pidlRB pidl
SHGetDesktopFolder(&sfD)
SHGetSpecialFolderLocation(0 CSIDL_BITBUCKET &pidlRB)
sfD.BindToObject(pidlRB 0 IID_IShellFolder2 &sfRB)
CoTaskMemFree pidlRB

str s1 s2 s3 s4; str* sp=&s1; int i
SHELLDETAILS sd

;column headers
for i 0 4
,sfRB.GetDetailsOf(0 i &sd)
,sp[i].FromSTRRET(sd.str)
out "<><Z 0xff00>%-25s %-50s %-20s %-20s</Z>" s1 s2 s3 s4

IEnumIDList en
sfRB.EnumObjects(0 SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN &en)
rep
,en.Next(1 &pidl &_i); if(_hresult) break
,
,;;location
,;STRRET sr; sfRB.GetDisplayNameOf(pidl 0 &sr)
,;str s.FromSTRRET(sr pidl)
,;out s
,
,;columns
,for i 0 4
,,sfRB.GetDetailsOf(pidl i &sd)
,,sp[i].FromSTRRET(sd.str pidl)
,s3.findreplace("[0xe2][0x80][0x8e]"); s3.findreplace("[0xe2][0x80][0x8f]") ;;right-to-left mark etc
,out "%-25s %-50s %-20s %-20s" s1 s2 s3 s4
,
,CoTaskMemFree pidl
,

Member function str.FromSTRRET
Code:
Copy      Help
function$ STRRET&sr [ITEMIDLIST*pidl]

word* w
StrRetToStrW(&sr pidl &w)
ansi(w)
CoTaskMemFree w
ret this
#6
Great! Many thanks, Best Personal Regards.


Forum Jump:


Users browsing this thread: 1 Guest(s)