internal static Int64 ComputeRecycleBinSize(string path)
        {
            //Int32 hResult;
            ShellQueryRecycledBinInformationStructure oQueryInfo = new ShellQueryRecycledBinInformationStructure(false);

            /*hResult = */ ShellApiNativeMethods.SHQueryRecycleBin(path, ref oQueryInfo);
            // Using a path like @"C:\" doesn't work :( but works in C++
            //hResult = ApiNativeMethods.SHQueryRecycleBin (@"C:\", ref oQueryInfo);

            return(oQueryInfo.SizeOn64Bits);
        }
        public static Icon GetIcon(string path, bool selected)
        {
            ShellFileInformationStructure info = new ShellFileInformationStructure(true);
            int   cbFileInfo = Marshal.SizeOf(info);
            SHGFI flags;

            if (!selected)
            {
                flags = SHGFI.SHGFI_ICON | SHGFI.SHGFI_SMALLICON;
            }
            else
            {
                flags = SHGFI.SHGFI_ICON | SHGFI.SHGFI_SMALLICON | SHGFI.SHGFI_OPENICON;
            }

            ShellApiNativeMethods.SHGetFileInfo(path, 256, out info, (uint)cbFileInfo, flags);
            return(Icon.FromHandle(info.IconHandle));
        }
 public static void EmptyRecycleBin(IntPtr hwndOwner)
 {
     ShellApiNativeMethods.SHEmptyRecycleBin((int)hwndOwner, null, SHERB.SHERB_NOCONFIRMATION | SHERB.SHERB_NOSOUND);
 }