T
Thomas Halwax
Hi,
I wrote some code using the shell32.dll to query the size of the
recycle bin. The function does not produce an error but the results
are not correct:
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
public struct SHQUERYRBINFO
{
public Int32 cbSize;
public UInt64 i64Size;
public UInt64 i64NumItems;
}
[DllImport("shell32.dll" , CharSet = CharSet.Unicode)]
public static extern int SHQueryRecycleBin(
[MarshalAs(UnmanagedType.LPTStr)]
String pszRootPath,
ref SHQUERYRBINFO pSHQueryRBInfo
);
SHQUERYRBINFO bb_query = new SHQUERYRBINFO();
bb_query.cbSize = Marshal.SizeOf(bb_query.GetType());
iRetVal = (int)SHQueryRecycleBin(BitBucket_Path, ref bb_query);
iRetVal is 0, but:
* if there are elements in the recycle bin the size is always
4294967296 and the number of elements is 0
* if the recycle bin is empty the size is 0 and the number of elements
is 0 (this is correct)
Any hints what's wrong? Are there other shell32 functions to query
single objects in the bin?
Thanks for your help,
Thomas
I wrote some code using the shell32.dll to query the size of the
recycle bin. The function does not produce an error but the results
are not correct:
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
public struct SHQUERYRBINFO
{
public Int32 cbSize;
public UInt64 i64Size;
public UInt64 i64NumItems;
}
[DllImport("shell32.dll" , CharSet = CharSet.Unicode)]
public static extern int SHQueryRecycleBin(
[MarshalAs(UnmanagedType.LPTStr)]
String pszRootPath,
ref SHQUERYRBINFO pSHQueryRBInfo
);
SHQUERYRBINFO bb_query = new SHQUERYRBINFO();
bb_query.cbSize = Marshal.SizeOf(bb_query.GetType());
iRetVal = (int)SHQueryRecycleBin(BitBucket_Path, ref bb_query);
iRetVal is 0, but:
* if there are elements in the recycle bin the size is always
4294967296 and the number of elements is 0
* if the recycle bin is empty the size is 0 and the number of elements
is 0 (this is correct)
Any hints what's wrong? Are there other shell32 functions to query
single objects in the bin?
Thanks for your help,
Thomas