Example #1
0
            public bool MoveNext()
            {
                if (clonePidl != IntPtr.Zero)
                {
                    Marshal.FreeCoTaskMem(clonePidl);
                    clonePidl = IntPtr.Zero;
                }

                if (start)
                {
                    start = false;
                    return(true);
                }
                else
                {
                    IntPtr newPidl = ILGetNext(currentPidl);

                    if (!PIDL.IsEmpty(newPidl))
                    {
                        currentPidl = newPidl;
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
Example #2
0
        internal ShellItem(ShellBrowserComponent browser, IntPtr pidl, IntPtr shellFolderPtr)
        {
            this.browser = browser;

            this.shellFolderPtr = shellFolderPtr;
            this.shellFolder = (IShellFolder)Marshal.GetTypedObjectForIUnknown(shellFolderPtr, typeof(IShellFolder));
            subFiles = new ShellItemCollection(this);
            subFolders = new ShellItemCollection(this);

            pidlRel = new PIDL(pidl, false);

            text = "Desktop";
            path = "Desktop";

            SetAttributesDesktop(this);

            NativeShellAPI.SHFILEINFO info = new NativeShellAPI.SHFILEINFO();
            NativeShellAPI.SHGetFileInfo(pidlRel.Ptr, 0, ref info, NativeShellAPI.cbFileInfo,
                NativeShellAPI.SHGFI.PIDL | NativeShellAPI.SHGFI.TYPENAME | NativeShellAPI.SHGFI.SYSICONINDEX);

            type = info.szTypeName;

            ShellImageList.SetIconIndex(this, info.iIcon, false);
            ShellImageList.SetIconIndex(this, info.iIcon, true);

            sortFlag = 1;
        }
Example #3
0
 public PIDL(PIDL pidl, bool clone)
 {
     if (clone)
         this.pidl = ILClone(pidl.Ptr);
     else
         this.pidl = pidl.Ptr;
 }
        internal ShellItem GetShellItem(PIDL pidlFull)
        {
            ShellItem current = DesktopItem;

            if (pidlFull.Ptr == IntPtr.Zero)
            {
                return(current);
            }

            foreach (IntPtr pidlRel in pidlFull)
            {
                int index;
                if ((index = current.IndexOf(pidlRel)) > -1)
                {
                    current = current[index];
                }
                else
                {
                    current = null;
                    break;
                }
            }

            return(current);
        }
Example #5
0
 public PIDL(PIDL pidl, bool clone)
 {
     if (clone)
     {
         this.pidl = ILClone(pidl.Ptr);
     }
     else
     {
         this.pidl = pidl.Ptr;
     }
 }
Example #6
0
        internal ShellItem(ShellBrowserComponent browser, ShellItem parentItem, IntPtr pidl, IntPtr shellFolderPtr)
        {
            this.browser = browser;

            this.parentItem = parentItem;
            this.shellFolderPtr = shellFolderPtr;
            this.shellFolder = (IShellFolder)Marshal.GetTypedObjectForIUnknown(shellFolderPtr, typeof(IShellFolder));
            subFiles = new ShellItemCollection(this);
            subFolders = new ShellItemCollection(this);

            pidlRel = new PIDL(pidl, false);

            SetText(this);
            SetPath(this);
            SetAttributesFolder(this);
            SetInfo(this);                       

            sortFlag = MakeSortFlag(this);
        }
        internal ShellItem GetShellItem(PIDL pidlFull)
        {
            ShellItem current = DesktopItem;
            if (pidlFull.Ptr == IntPtr.Zero)
                return current;

            foreach (IntPtr pidlRel in pidlFull)
            {
                int index;
                if ((index = current.IndexOf(pidlRel)) > -1)
                {
                    current = current[index];
                }
                else
                {
                    current = null;
                    break;
                }
            }

            return current;
        }
Example #8
0
        internal ShellItem(ShellBrowserComponent browser, ShellItem parentItem, IntPtr pidl)
        {
            this.browser = browser;

            this.parentItem = parentItem;

            pidlRel = new PIDL(pidl, false);

            SetText(this);
            SetPath(this);
            SetAttributesFile(this);
            SetInfo(this);                        

            sortFlag = MakeSortFlag(this);
        }
Example #9
0
        internal void Update(IntPtr newPidlFull, ShellItemUpdateType changeType)
        {
            browser.UpdateCondition.ContinueUpdate = false;

            lock (browser)
            {
                #region Change Pidl and ShellFolder

                if (newPidlFull != IntPtr.Zero)
                {
                    IntPtr tempPidl = PIDL.ILClone(PIDL.ILFindLastID(newPidlFull)), newPidlRel, newShellFolderPtr;
                    NativeShellAPI.SHGetRealIDL(ParentItem.ShellFolder, tempPidl, out newPidlRel);

                    if (IsFolder && ParentItem.ShellFolder.BindToObject(
                                        newPidlRel,
                                        IntPtr.Zero,
                                        ref NativeShellAPI.IID_IShellFolder,
                                        out newShellFolderPtr) == NativeShellAPI.S_OK)
                    {
                        Marshal.ReleaseComObject(shellFolder);
                        Marshal.Release(shellFolderPtr);
                        pidlRel.Free();

                        shellFolderPtr = newShellFolderPtr;
                        shellFolder = (IShellFolder)Marshal.GetTypedObjectForIUnknown(shellFolderPtr, typeof(IShellFolder));
                        pidlRel = new PIDL(newPidlRel, false);

                        foreach (ShellItem child in SubFolders)
                            UpdateShellFolders(child);
                    }
                    else
                    {
                        pidlRel.Free();
                        pidlRel = new PIDL(newPidlRel, false);
                    }

                    Marshal.FreeCoTaskMem(tempPidl);
                    Marshal.FreeCoTaskMem(newPidlFull);
                }

                #endregion

                #region Make Other Changes

                switch (changeType)
                {
                    case ShellItemUpdateType.Renamed:
                        SetText(this);
                        SetPath(this);
                        break;

                    case ShellItemUpdateType.Updated:
                        if (IsFolder)
                            SetAttributesFolder(this);
                        else
                            SetAttributesFile(this);
                        break;

                    case ShellItemUpdateType.MediaChange:
                        SetInfo(this);
                        Clear(true, true);
                        break;

                    case ShellItemUpdateType.IconChange:
                        SetInfo(this);
                        break;
                }

                #endregion
            }

            Browser.OnShellItemUpdate(ParentItem, new ShellItemUpdateEventArgs(this, this, changeType));
        }
Example #10
0
        internal static void SetIconIndex(ShellItem item, int index, bool SelectedIcon)
        {
            bool HasOverlay = false; //true if it's an overlay
            int  rVal       = 0;     //The returned Index

            NativeShellAPI.SHGFI          dwflag = NativeShellAPI.SHGFI.SYSICONINDEX | NativeShellAPI.SHGFI.PIDL | NativeShellAPI.SHGFI.ICON;
            NativeShellAPI.FILE_ATTRIBUTE dwAttr = 0;
            //build Key into HashTable for this Item
            int Key = index * 256;

            if (item.IsLink)
            {
                Key        = Key | 1;
                dwflag     = dwflag | NativeShellAPI.SHGFI.LINKOVERLAY;
                HasOverlay = true;
            }
            if (item.IsShared)
            {
                Key        = Key | 2;
                dwflag     = dwflag | NativeShellAPI.SHGFI.ADDOVERLAYS;
                HasOverlay = true;
            }
            if (SelectedIcon)
            {
                Key        = Key | 4;
                dwflag     = dwflag | NativeShellAPI.SHGFI.OPENICON;
                HasOverlay = true; //not really an overlay, but handled the same
            }

            if (imageTable.ContainsKey(Key))
            {
                rVal = (int)imageTable[Key];
            }
            else if (!HasOverlay && !item.IsHidden)                          //for non-overlay icons, we already have
            {
                rVal            = (int)System.Math.Floor((double)Key / 256); // the right index -- put in table
                imageTable[Key] = rVal;
            }
            else //don't have iconindex for an overlay, get it.
            {
                if (item.IsFileSystem & !item.IsDisk & !item.IsFolder)
                {
                    dwflag = dwflag | NativeShellAPI.SHGFI.USEFILEATTRIBUTES;
                    dwAttr = dwAttr | NativeShellAPI.FILE_ATTRIBUTE.NORMAL;
                }

                PIDL pidlFull = item.PIDLFull;

                NativeShellAPI.SHFILEINFO shfiSmall = new NativeShellAPI.SHFILEINFO();
                NativeShellAPI.SHGetFileInfo(pidlFull.Ptr, dwAttr, ref shfiSmall, NativeShellAPI.cbFileInfo, dwflag | NativeShellAPI.SHGFI.SMALLICON);

                NativeShellAPI.SHFILEINFO shfiLarge = new NativeShellAPI.SHFILEINFO();
                NativeShellAPI.SHGetFileInfo(pidlFull.Ptr, dwAttr, ref shfiLarge, NativeShellAPI.cbFileInfo, dwflag | NativeShellAPI.SHGFI.LARGEICON);

                Marshal.FreeCoTaskMem(pidlFull.Ptr);

                lock (imageTable)
                {
                    rVal = NativeShellAPI.ImageList_ReplaceIcon(smallImageListHandle, -1, shfiSmall.hIcon);
                    NativeShellAPI.ImageList_ReplaceIcon(largeImageListHandle, -1, shfiLarge.hIcon);
                }

                NativeShellAPI.DestroyIcon(shfiSmall.hIcon);
                NativeShellAPI.DestroyIcon(shfiLarge.hIcon);
                imageTable[Key] = rVal;
            }

            if (SelectedIcon)
            {
                item.SelectedImageIndex = rVal;
            }
            else
            {
                item.ImageIndex = rVal;
            }
        }
Example #11
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == (int)NativeShellAPI.WM.SH_NOTIFY)
            {
                NativeShellAPI.SHNOTIFYSTRUCT shNotify =
                    (NativeShellAPI.SHNOTIFYSTRUCT)Marshal.PtrToStructure(m.WParam, typeof(NativeShellAPI.SHNOTIFYSTRUCT));

                //Console.Out.WriteLine("Event: {0}", (ShellAPI.SHCNE)m.LParam);
                //if (shNotify.dwItem1 != IntPtr.Zero)
                    //PIDL.Write(shNotify.dwItem1);
                //if (shNotify.dwItem2 != IntPtr.Zero)
                    //PIDL.Write(shNotify.dwItem2);

                switch ((NativeShellAPI.SHCNE)m.LParam)
                {
                    #region File Changes

                    case NativeShellAPI.SHCNE.CREATE:
                        #region Create Item
                        {
                            if (!PIDL.IsEmpty(shNotify.dwItem1))
                            {
                                IntPtr parent, child, relative;
                                PIDL.SplitPidl(shNotify.dwItem1, out parent, out child);

                                PIDL parentPIDL = new PIDL(parent, false);
                                ShellItem parentItem = br.GetShellItem(parentPIDL);
                                if (parentItem != null && parentItem.FilesExpanded && !parentItem.SubFiles.Contains(child))
                                {
                                    NativeShellAPI.SHGetRealIDL(
                                        parentItem.ShellFolder,
                                        child,
                                        out relative);
                                    parentItem.AddItem(new ShellItem(br, parentItem, relative));
                                }
                                    
                                Marshal.FreeCoTaskMem(child);
                                parentPIDL.Free();
                            }
                        }
                        #endregion
                        break;

                    case NativeShellAPI.SHCNE.RENAMEITEM:
                        #region Rename Item
                        {
                            if (!PIDL.IsEmpty(shNotify.dwItem1) && !PIDL.IsEmpty(shNotify.dwItem2))
                            {
                                ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, true));
                                if (item != null)
                                    item.Update(shNotify.dwItem2, ShellItemUpdateType.Renamed);
                            }
                        }
                        #endregion
                        break;

                    case NativeShellAPI.SHCNE.DELETE:
                        #region Delete Item
                        {
                            if (!PIDL.IsEmpty(shNotify.dwItem1))
                            {
                                IntPtr parent, child;
                                PIDL.SplitPidl(shNotify.dwItem1, out parent, out child);

                                PIDL parentPIDL = new PIDL(parent, false);
                                ShellItem parentItem = br.GetShellItem(parentPIDL);
                                if (parentItem != null && parentItem.SubFiles.Contains(child))
                                    parentItem.RemoveItem(parentItem.SubFiles[child]);

                                Marshal.FreeCoTaskMem(child);
                                parentPIDL.Free();
                            }
                        }
                        #endregion
                        break;

                    case NativeShellAPI.SHCNE.UPDATEITEM:
                        #region Update Item
                        {
                            if (!PIDL.IsEmpty(shNotify.dwItem1))
                            {
                                ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, true));
                                if (item != null)
                                {
                                    Console.Out.WriteLine("Item: {0}", item);
                                    item.Update(IntPtr.Zero, ShellItemUpdateType.Updated);
                                    item.Update(IntPtr.Zero, ShellItemUpdateType.IconChange);
                                }
                            }
                        }
                        #endregion
                        break;

                    #endregion

                    #region Folder Changes

                    case NativeShellAPI.SHCNE.MKDIR:                        
                    case NativeShellAPI.SHCNE.DRIVEADD:
                    case NativeShellAPI.SHCNE.DRIVEADDGUI:                        
                        #region Make Directory
                        {
                            if (!PIDL.IsEmpty(shNotify.dwItem1))
                            {
                                IntPtr parent, child, relative;
                                PIDL.SplitPidl(shNotify.dwItem1, out parent, out child);

                                PIDL parentPIDL = new PIDL(parent, false);
                                ShellItem parentItem = br.GetShellItem(parentPIDL);
                                if (parentItem != null && parentItem.FoldersExpanded && !parentItem.SubFolders.Contains(child))
                                {
                                    NativeShellAPI.SHGetRealIDL(
                                        parentItem.ShellFolder,
                                        child,
                                        out relative);

                                    IntPtr shellFolderPtr;
                                    if (parentItem.ShellFolder.BindToObject(
                                                relative,
                                                IntPtr.Zero,
                                                ref NativeShellAPI.IID_IShellFolder,
                                                out shellFolderPtr) == NativeShellAPI.S_OK)
                                    {
                                        parentItem.AddItem(new ShellItem(br, parentItem, relative, shellFolderPtr));
                                    }
                                    else
                                        Marshal.FreeCoTaskMem(relative);
                                }

                                Marshal.FreeCoTaskMem(child);
                                parentPIDL.Free();
                            }
                        }
                        #endregion
                        break;

                    case NativeShellAPI.SHCNE.RENAMEFOLDER:
                        #region Rename Directory
                        {
                            if (!PIDL.IsEmpty(shNotify.dwItem1) && !PIDL.IsEmpty(shNotify.dwItem2))
                            {
                                ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, false));
                                if (item != null)
                                {
                                    //Console.Out.WriteLine("Update: {0}", item);
                                    item.Update(shNotify.dwItem2, ShellItemUpdateType.Renamed);
                                }
                            }
                        }
                        #endregion
                        break;

                    case NativeShellAPI.SHCNE.RMDIR:
                    case NativeShellAPI.SHCNE.DRIVEREMOVED:
                        #region Remove Directory
                        {
                            if (!PIDL.IsEmpty(shNotify.dwItem1))
                            {
                                IntPtr parent, child;
                                PIDL.SplitPidl(shNotify.dwItem1, out parent, out child);

                                PIDL parentPIDL = new PIDL(parent, false);
                                ShellItem parentItem = br.GetShellItem(parentPIDL);
                                if (parentItem != null && parentItem.SubFolders.Contains(child))
                                    parentItem.RemoveItem(parentItem.SubFolders[child]);

                                Marshal.FreeCoTaskMem(child);
                                parentPIDL.Free();
                            }
                        }
                        #endregion
                        break;

                    case NativeShellAPI.SHCNE.UPDATEDIR:
                    case NativeShellAPI.SHCNE.ATTRIBUTES:
                        #region Update Directory
                        {
                            if (!PIDL.IsEmpty(shNotify.dwItem1))
                            {
                                ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, true));
                                if (item != null)
                                {
                                    item.Update(IntPtr.Zero, ShellItemUpdateType.Updated);
                                    item.Update(IntPtr.Zero, ShellItemUpdateType.IconChange);
                                }
                            }
                        }
                        #endregion
                        break;

                    case NativeShellAPI.SHCNE.MEDIAINSERTED:
                    case NativeShellAPI.SHCNE.MEDIAREMOVED:
                        #region Media Change
                        {
                            if (!PIDL.IsEmpty(shNotify.dwItem1))
                            {
                                ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, true));
                                if (item != null)
                                    item.Update(IntPtr.Zero, ShellItemUpdateType.MediaChange);
                            }
                        }
                        #endregion
                        break;

                    #endregion

                    #region Other Changes

                    case NativeShellAPI.SHCNE.ASSOCCHANGED:
                        #region Update Images
                        {
                            
                        }
                        #endregion
                        break;

                    case NativeShellAPI.SHCNE.NETSHARE:
                    case NativeShellAPI.SHCNE.NETUNSHARE:
                        break;

                    case NativeShellAPI.SHCNE.UPDATEIMAGE:
                        UpdateRecycleBin();
                        break;

                    #endregion
                }
            }

            base.WndProc(ref m);
        }
Example #12
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == (int)NativeShellAPI.WM.SH_NOTIFY)
            {
                NativeShellAPI.SHNOTIFYSTRUCT shNotify =
                    (NativeShellAPI.SHNOTIFYSTRUCT)Marshal.PtrToStructure(m.WParam, typeof(NativeShellAPI.SHNOTIFYSTRUCT));

                //Console.Out.WriteLine("Event: {0}", (ShellAPI.SHCNE)m.LParam);
                //if (shNotify.dwItem1 != IntPtr.Zero)
                //PIDL.Write(shNotify.dwItem1);
                //if (shNotify.dwItem2 != IntPtr.Zero)
                //PIDL.Write(shNotify.dwItem2);

                switch ((NativeShellAPI.SHCNE)m.LParam)
                {
                    #region File Changes

                case NativeShellAPI.SHCNE.CREATE:
                    #region Create Item
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1))
                    {
                        IntPtr parent, child, relative;
                        PIDL.SplitPidl(shNotify.dwItem1, out parent, out child);

                        PIDL      parentPIDL = new PIDL(parent, false);
                        ShellItem parentItem = br.GetShellItem(parentPIDL);
                        if (parentItem != null && parentItem.FilesExpanded && !parentItem.SubFiles.Contains(child))
                        {
                            NativeShellAPI.SHGetRealIDL(
                                parentItem.ShellFolder,
                                child,
                                out relative);
                            parentItem.AddItem(new ShellItem(br, parentItem, relative));
                        }

                        Marshal.FreeCoTaskMem(child);
                        parentPIDL.Free();
                    }
                }
                    #endregion
                    break;

                case NativeShellAPI.SHCNE.RENAMEITEM:
                    #region Rename Item
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1) && !PIDL.IsEmpty(shNotify.dwItem2))
                    {
                        ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, true));
                        if (item != null)
                        {
                            item.Update(shNotify.dwItem2, ShellItemUpdateType.Renamed);
                        }
                    }
                }
                    #endregion
                    break;

                case NativeShellAPI.SHCNE.DELETE:
                    #region Delete Item
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1))
                    {
                        IntPtr parent, child;
                        PIDL.SplitPidl(shNotify.dwItem1, out parent, out child);

                        PIDL      parentPIDL = new PIDL(parent, false);
                        ShellItem parentItem = br.GetShellItem(parentPIDL);
                        if (parentItem != null && parentItem.SubFiles.Contains(child))
                        {
                            parentItem.RemoveItem(parentItem.SubFiles[child]);
                        }

                        Marshal.FreeCoTaskMem(child);
                        parentPIDL.Free();
                    }
                }
                    #endregion
                    break;

                case NativeShellAPI.SHCNE.UPDATEITEM:
                    #region Update Item
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1))
                    {
                        ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, true));
                        if (item != null)
                        {
                            Console.Out.WriteLine("Item: {0}", item);
                            item.Update(IntPtr.Zero, ShellItemUpdateType.Updated);
                            item.Update(IntPtr.Zero, ShellItemUpdateType.IconChange);
                        }
                    }
                }
                    #endregion
                    break;

                    #endregion

                    #region Folder Changes

                case NativeShellAPI.SHCNE.MKDIR:
                case NativeShellAPI.SHCNE.DRIVEADD:
                case NativeShellAPI.SHCNE.DRIVEADDGUI:
                    #region Make Directory
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1))
                    {
                        IntPtr parent, child, relative;
                        PIDL.SplitPidl(shNotify.dwItem1, out parent, out child);

                        PIDL      parentPIDL = new PIDL(parent, false);
                        ShellItem parentItem = br.GetShellItem(parentPIDL);
                        if (parentItem != null && parentItem.FoldersExpanded && !parentItem.SubFolders.Contains(child))
                        {
                            NativeShellAPI.SHGetRealIDL(
                                parentItem.ShellFolder,
                                child,
                                out relative);

                            IntPtr shellFolderPtr;
                            if (parentItem.ShellFolder.BindToObject(
                                    relative,
                                    IntPtr.Zero,
                                    ref NativeShellAPI.IID_IShellFolder,
                                    out shellFolderPtr) == NativeShellAPI.S_OK)
                            {
                                parentItem.AddItem(new ShellItem(br, parentItem, relative, shellFolderPtr));
                            }
                            else
                            {
                                Marshal.FreeCoTaskMem(relative);
                            }
                        }

                        Marshal.FreeCoTaskMem(child);
                        parentPIDL.Free();
                    }
                }
                    #endregion
                    break;

                case NativeShellAPI.SHCNE.RENAMEFOLDER:
                    #region Rename Directory
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1) && !PIDL.IsEmpty(shNotify.dwItem2))
                    {
                        ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, false));
                        if (item != null)
                        {
                            //Console.Out.WriteLine("Update: {0}", item);
                            item.Update(shNotify.dwItem2, ShellItemUpdateType.Renamed);
                        }
                    }
                }
                    #endregion
                    break;

                case NativeShellAPI.SHCNE.RMDIR:
                case NativeShellAPI.SHCNE.DRIVEREMOVED:
                    #region Remove Directory
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1))
                    {
                        IntPtr parent, child;
                        PIDL.SplitPidl(shNotify.dwItem1, out parent, out child);

                        PIDL      parentPIDL = new PIDL(parent, false);
                        ShellItem parentItem = br.GetShellItem(parentPIDL);
                        if (parentItem != null && parentItem.SubFolders.Contains(child))
                        {
                            parentItem.RemoveItem(parentItem.SubFolders[child]);
                        }

                        Marshal.FreeCoTaskMem(child);
                        parentPIDL.Free();
                    }
                }
                    #endregion
                    break;

                case NativeShellAPI.SHCNE.UPDATEDIR:
                case NativeShellAPI.SHCNE.ATTRIBUTES:
                    #region Update Directory
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1))
                    {
                        ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, true));
                        if (item != null)
                        {
                            item.Update(IntPtr.Zero, ShellItemUpdateType.Updated);
                            item.Update(IntPtr.Zero, ShellItemUpdateType.IconChange);
                        }
                    }
                }
                    #endregion
                    break;

                case NativeShellAPI.SHCNE.MEDIAINSERTED:
                case NativeShellAPI.SHCNE.MEDIAREMOVED:
                    #region Media Change
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1))
                    {
                        ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, true));
                        if (item != null)
                        {
                            item.Update(IntPtr.Zero, ShellItemUpdateType.MediaChange);
                        }
                    }
                }
                    #endregion
                    break;

                    #endregion

                    #region Other Changes

                case NativeShellAPI.SHCNE.ASSOCCHANGED:
                    #region Update Images
                {
                }
                    #endregion
                    break;

                case NativeShellAPI.SHCNE.NETSHARE:
                case NativeShellAPI.SHCNE.NETUNSHARE:
                    break;

                case NativeShellAPI.SHCNE.UPDATEIMAGE:
                    UpdateRecycleBin();
                    break;

                    #endregion
                }
            }

            base.WndProc(ref m);
        }