• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ShellDll.ShellItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ShellDll.ShellItem的典型用法代码示例。如果您正苦于以下问题:C# ShellItem类的具体用法?C# ShellItem怎么用?C# ShellItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ShellItem类属于ShellDll命名空间,在下文中一共展示了ShellItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ShellStreamReader

        internal ShellStreamReader(ShellItem shellItem, IStorage parentStorage, FileAccess access)
        {
            this.shellItem = shellItem;

            OpenStream(parentStorage, ref access);

            this.canRead = (access == FileAccess.Read || access == FileAccess.ReadWrite);
            this.canWrite = (access == FileAccess.Write || access == FileAccess.ReadWrite);
            currentPos = 0;
        }
开发者ID:davidcon,项目名称:ScreenGrab,代码行数:10,代码来源:StreamStorage.cs


示例2: InitVars

        private void InitVars()
        {
            IntPtr tempPidl;
            ShellAPI.SHFILEINFO info;

            //My Computer
            info = new ShellAPI.SHFILEINFO();
            tempPidl = IntPtr.Zero;
            ShellAPI.SHGetSpecialFolderLocation(IntPtr.Zero, ShellAPI.CSIDL.DRIVES, out tempPidl);

            ShellAPI.SHGetFileInfo(tempPidl, 0, ref info, ShellAPI.cbFileInfo,
                ShellAPI.SHGFI.PIDL | ShellAPI.SHGFI.DISPLAYNAME | ShellAPI.SHGFI.TYPENAME);

            sysfolderName = info.szTypeName;
            mycompName = info.szDisplayName;
            Marshal.FreeCoTaskMem(tempPidl);
            //

            //Dekstop
            tempPidl = IntPtr.Zero;
            ShellAPI.SHGetSpecialFolderLocation(IntPtr.Zero, ShellAPI.CSIDL.DESKTOP, out tempPidl);
            IntPtr desktopFolderPtr;
            ShellAPI.SHGetDesktopFolder(out desktopFolderPtr);
            desktopItem = new ShellItem(this, tempPidl, desktopFolderPtr);
            //


            //My Documents
            uint pchEaten = 0;
            ShellAPI.SFGAO pdwAttributes = 0;
            desktopItem.ShellFolder.ParseDisplayName(
                IntPtr.Zero,
                IntPtr.Zero,
                SpecialFolderPath.MyDocuments,
                ref pchEaten,
                out tempPidl,
                ref pdwAttributes);

            info = new ShellAPI.SHFILEINFO();
            ShellAPI.SHGetFileInfo(tempPidl, 0, ref info, ShellAPI.cbFileInfo,
                ShellAPI.SHGFI.PIDL | ShellAPI.SHGFI.DISPLAYNAME);

            mydocsName = info.szDisplayName;
            Marshal.FreeCoTaskMem(tempPidl);

            StringBuilder path = new StringBuilder(ShellAPI.MAX_PATH);
            ShellAPI.SHGetFolderPath(
                    IntPtr.Zero, ShellAPI.CSIDL.PERSONAL,
                    IntPtr.Zero, ShellAPI.SHGFP.TYPE_CURRENT, path);
            mydocsPath = path.ToString();
            //
        }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:52,代码来源:ShellBrowser.cs


示例3: ShellItem

        internal ShellItem(ShellBrowser 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);
        }
开发者ID:art-drobanov,项目名称:RecoveryStar,代码行数:15,代码来源:ShellItem.cs


示例4: ShellItem

        public ShellItem(ShellBrowser 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);
        }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:15,代码来源:ShellItem.cs


示例5: GetListItem

        public bool GetListItem(ShellItem shellItem, out ListViewItem listItem)
        {
            listItem = null;

            foreach (ListViewItem item in Items)
            {
                if (shellItem.Equals(item.Tag))
                {
                    listItem = item;
                    return true;
                }
            }

            return false;
        }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:15,代码来源:ShellListView.cs


示例6: GetIStorage

 public static bool GetIStorage(ShellItem item, out IntPtr storagePtr, out IStorage storage)
 {
     if (item.ParentItem.ShellFolder.BindToStorage(
                 item.PIDLRel.Ptr,
                 IntPtr.Zero,
                 ref ShellAPI.IID_IStorage,
                 out storagePtr) == ShellAPI.S_OK)
     {
         storage = (IStorage)Marshal.GetTypedObjectForIUnknown(storagePtr, typeof(IStorage));
         return true;
     }
     else
     {
         storage = null;
         storagePtr = IntPtr.Zero;
         return false;
     }
 }
开发者ID:Alenochka17,项目名称:laba3,代码行数:18,代码来源:ShellHelper.cs


示例7: GetIDataObject

        /// <summary>
        /// This method will use the GetUIObjectOf method of IShellFolder to obtain the IDataObject of a
        /// ShellItem. 
        /// </summary>
        /// <param name="item">The item for which to obtain the IDataObject</param>
        /// <param name="dataObjectPtr">A pointer to the returned IDataObject</param>
        /// <returns>the IDataObject the ShellItem</returns>
        public static IntPtr GetIDataObject(ShellItem[] items)
        {
            ShellItem parent = items[0].ParentItem != null ? items[0].ParentItem : items[0];

            IntPtr[] pidls = new IntPtr[items.Length];
            for (int i = 0; i < items.Length; i++)
                pidls[i] = items[i].PIDLRel.Ptr;

            IntPtr dataObjectPtr;
            if (parent.ShellFolder.GetUIObjectOf(
                    IntPtr.Zero,
                    (uint)pidls.Length,
                    pidls,
                    ref ShellAPI.IID_IDataObject,
                    IntPtr.Zero,
                    out dataObjectPtr) == ShellAPI.S_OK)
            {
                return dataObjectPtr;
            }
            else
            {
                return IntPtr.Zero;
            }
        }
开发者ID:davidcon,项目名称:ScreenGrab,代码行数:31,代码来源:ShellHelper.cs


示例8: GetTreeNode

        public bool GetTreeNode(ShellItem shellItem, out TreeNode treeNode)
        {
            ArrayList pathList = new ArrayList();

            while (shellItem.ParentItem != null)
            {
                pathList.Add(shellItem);
                shellItem = shellItem.ParentItem;
            }
            pathList.Add(shellItem);

            pathList.Reverse();

            treeNode = Nodes[0];
            for (int i = 1; i < pathList.Count; i++)
            {
                bool found = false;
                foreach (TreeNode node in treeNode.Nodes)
                {
                    if (node.Tag != null && node.Tag.Equals(pathList[i]))
                    {
                        treeNode = node;
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    treeNode = null;
                    return false;
                }
            }

            return true;
        }
开发者ID:davidcon,项目名称:ScreenGrab,代码行数:36,代码来源:BrowserControls.cs


示例9: DragOver

        public int DragOver(ShellAPI.MK grfKeyState, ShellAPI.POINT pt, ref DragDropEffects pdwEffect)
        {
            bool reset = false;

            #region Get DropItem

            Point point = br.FolderView.PointToClient(new Point(pt.x, pt.y));
            TreeViewHitTestInfo hitTest = br.FolderView.HitTest(point);
            if(!TreeNode.Equals(dropNode, hitTest.Node))
            {
                if(dropTarget != null)
                    dropTarget.DragLeave();

                ReleaseCom();

                dropNode = hitTest.Node;
                br.FolderView.SelectedNode = dropNode;

                if(dropNode == null)
                {
                    pdwEffect = DragDropEffects.None;

                    if(dropHelper != null)
                        dropHelper.DragOver(ref pt, pdwEffect);

                    return ShellAPI.S_OK;
                }
                else
                {
                    ShellItem item = (ShellItem)dropNode.Tag;
                    parentDropItem = item;

                    ShellHelper.GetIDropTarget(item, out dropTargetPtr, out dropTarget);
                    reset = true;
                }
            }
            else if(dropNode == null)
            {
                if(dropTarget != null)
                    dropTarget.DragLeave();

                ReleaseCom();

                dropNode = null;
                br.SelectedNode = null;

                pdwEffect = DragDropEffects.None;

                if(dropHelper != null)
                    dropHelper.DragOver(ref pt, pdwEffect);

                return ShellAPI.S_OK;
            }

            #endregion

            if(dropTarget != null)
            {
                if(reset)
                    dropTarget.DragEnter(dropDataObject, grfKeyState, pt, ref pdwEffect);
                else
                    dropTarget.DragOver(grfKeyState, pt, ref pdwEffect);
            }
            else
                pdwEffect = DragDropEffects.None;

            if(dropHelper != null)
                dropHelper.DragOver(ref pt, pdwEffect);

            return ShellAPI.S_OK;
        }
开发者ID:art-drobanov,项目名称:RecoveryStar,代码行数:71,代码来源:BrowserDropWrappers.cs


示例10: SetIconIndex

        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

            ShellAPI.SHGFI dwflag = ShellAPI.SHGFI.SYSICONINDEX | ShellAPI.SHGFI.PIDL | ShellAPI.SHGFI.ICON;
            ShellAPI.FILE_ATTRIBUTE dwAttr = 0;
            //build Key into HashTable for this Item
            int Key = index * 256;
            if (item.IsLink)
            {
                Key = Key | 1;
                dwflag = dwflag | ShellAPI.SHGFI.LINKOVERLAY;
                HasOverlay = true;
            }
            if (item.IsShared)
            {
                Key = Key | 2;
                dwflag = dwflag | ShellAPI.SHGFI.ADDOVERLAYS;
                HasOverlay = true;
            }
            if (SelectedIcon)
            {
                Key = Key | 4;
                dwflag = dwflag | ShellAPI.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 | ShellAPI.SHGFI.USEFILEATTRIBUTES;
                    dwAttr = dwAttr | ShellAPI.FILE_ATTRIBUTE.NORMAL;
                }

                PIDL pidlFull = item.PIDLFull;

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

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

                Marshal.FreeCoTaskMem(pidlFull.Ptr);

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

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

            if (SelectedIcon)
                item.SelectedImageIndex = rVal;
            else
                item.ImageIndex = rVal;
        }
开发者ID:Alenochka17,项目名称:laba3,代码行数:71,代码来源:ShellImageList.cs


示例11: ShellItemUpdateEventArgs

 public ShellItemUpdateEventArgs(
     ShellItem oldItem,
     ShellItem newItem,
     ShellItemUpdateType type)
 {
     this.oldItem = oldItem;
     this.newItem = newItem;
     this.type = type;
 }
开发者ID:AdvSofTech,项目名称:BackupWiz,代码行数:9,代码来源:ShellBrowser.cs


示例12: CanDropClipboard

        public static DragDropEffects CanDropClipboard(ShellItem item)
        {
            IntPtr dataObject;
            ShellAPI.OleGetClipboard(out dataObject);

            IntPtr targetPtr;
            ShellDll.IDropTarget target;

            DragDropEffects retVal = DragDropEffects.None;
            if (GetIDropTarget(item, out targetPtr, out target))
            {
                #region Check Copy
                DragDropEffects effects = DragDropEffects.Copy;
                if (target.DragEnter(
                    dataObject,
                    ShellAPI.MK.CONTROL,
                    new ShellAPI.POINT(0, 0),
                    ref effects) == ShellAPI.S_OK)
                {
                    if (effects == DragDropEffects.Copy)
                        retVal |= DragDropEffects.Copy;

                    target.DragLeave();
                }
                #endregion

                #region Check Move
                effects = DragDropEffects.Move;
                if (target.DragEnter(
                    dataObject,
                    ShellAPI.MK.SHIFT,
                    new ShellAPI.POINT(0, 0),
                    ref effects) == ShellAPI.S_OK)
                {
                    if (effects == DragDropEffects.Move)
                        retVal |= DragDropEffects.Move;

                    target.DragLeave();
                }
                #endregion

                #region Check Lick
                effects = DragDropEffects.Link;
                if (target.DragEnter(
                    dataObject,
                    ShellAPI.MK.ALT,
                    new ShellAPI.POINT(0, 0),
                    ref effects) == ShellAPI.S_OK)
                {
                    if (effects == DragDropEffects.Link)
                        retVal |= DragDropEffects.Link;

                    target.DragLeave();
                }
                #endregion

                Marshal.ReleaseComObject(target);
                Marshal.Release(targetPtr);
            }

            return retVal;
        }
开发者ID:Alenochka17,项目名称:laba3,代码行数:62,代码来源:ShellHelper.cs


示例13: InvokeCommand

        /// <summary>
        /// Invokes a specific command for a set of pidls
        /// </summary>
        /// <param name="parent">the parent ShellItem which contains the pidls</param>
        /// <param name="pidls">the pidls from the items for which to invoke</param>
        /// <param name="cmd">the execute string from the command to invoke</param>
        /// <param name="ptInvoke">the point (in screen coördinates) from which to invoke</param>
        public static void InvokeCommand(ShellItem parent, IntPtr[] pidls, string cmd, Point ptInvoke)
        {
            IntPtr icontextMenuPtr;
            IContextMenu iContextMenu;

            if (GetIContextMenu(parent.ShellFolder, pidls, out icontextMenuPtr, out iContextMenu))
            {
                try
                {
                    InvokeCommand(
                        iContextMenu,
                        cmd,
                        ShellItem.GetRealPath(parent),
                        ptInvoke);
                }
                catch (Exception) { }
                finally
                {
                    if (iContextMenu != null)
                        Marshal.ReleaseComObject(iContextMenu);

                    if (icontextMenuPtr != IntPtr.Zero)
                        Marshal.Release(icontextMenuPtr);
                }
            }
        }
开发者ID:AdvSofTech,项目名称:BackupWiz,代码行数:33,代码来源:BrowserContextMenuWrappers.cs


示例14: DragOver

        public int DragOver(ShellAPI.MK grfKeyState, ShellAPI.POINT pt, ref DragDropEffects pdwEffect)
        {
            bool reset = false;

            #region Get DropItem

            Point point = br.FileView.PointToClient(new Point(pt.x, pt.y));
            ListViewHitTestInfo hitTest = br.FileView.HitTest(point);
            if (hitTest.Item != null &&
                (br.FileView.View != View.Details || hitTest.SubItem == null || hitTest.Item.Name == hitTest.SubItem.Name) &&
                (hitTest.Location == ListViewHitTestLocations.Image ||
                 hitTest.Location == ListViewHitTestLocations.Label ||
                 hitTest.Location == ListViewHitTestLocations.StateImage))
            {
                if (!hitTest.Item.Equals(dropListItem))
                {
                    if (dropTarget != null)
                        dropTarget.DragLeave();

                    ReleaseCom();

                    if (dropListItem != null)
                        dropListItem.Selected = wasSelected;

                    dropListItem = hitTest.Item;
                    wasSelected = dropListItem.Selected;
                    dropListItem.Selected = true;

                    ShellItem item = (ShellItem)dropListItem.Tag;
                    parentDropItem = item;

                    ShellHelper.GetIDropTarget(item, out dropTargetPtr, out dropTarget);
                    reset = true;
                }
            }
            else
            {
                if (dropListItem != null)
                {
                    if (dropTarget != null)
                        dropTarget.DragLeave();

                    ReleaseCom();

                    dropListItem.Selected = wasSelected;

                    dropListItem = null;
                    parentDropItem = br.SelectedItem;

                    ShellHelper.GetIDropTarget(br.SelectedItem, out dropTargetPtr, out dropTarget);
                    reset = true;
                }
            }

            #endregion

            if (dropTarget != null)
            {
                if (reset)
                    dropTarget.DragEnter(dropDataObject, grfKeyState, pt, ref pdwEffect);
                else
                    dropTarget.DragOver(grfKeyState, pt, ref pdwEffect);
            }
            else
                pdwEffect = DragDropEffects.None;

            if (dropHelper != null)
                dropHelper.DragOver(ref pt, pdwEffect);

            return ShellAPI.S_OK;
        }
开发者ID:ZAYEC77,项目名称:HCI5,代码行数:71,代码来源:BrowserDropWrappers.cs


示例15: GetNewContextMenu

        public static bool GetNewContextMenu(ShellItem item, out IntPtr iContextMenuPtr, out IContextMenu iContextMenu)
        {
            if (ShellAPI.CoCreateInstance(
                    ref ShellAPI.CLSID_NewMenu,
                    IntPtr.Zero,
                    ShellAPI.CLSCTX.INPROC_SERVER,
                    ref ShellAPI.IID_IContextMenu,
                    out iContextMenuPtr) == ShellAPI.S_OK)
            {
                iContextMenu = Marshal.GetTypedObjectForIUnknown(iContextMenuPtr, typeof(IContextMenu)) as IContextMenu;

                IntPtr iShellExtInitPtr;
                if (Marshal.QueryInterface(
                    iContextMenuPtr,
                    ref ShellAPI.IID_IShellExtInit,
                    out iShellExtInitPtr) == ShellAPI.S_OK)
                {
                    IShellExtInit iShellExtInit = Marshal.GetTypedObjectForIUnknown(
                        iShellExtInitPtr, typeof(IShellExtInit)) as IShellExtInit;

                    PIDL pidlFull = item.PIDLFull;
                    iShellExtInit.Initialize(pidlFull.Ptr, IntPtr.Zero, 0);

                    Marshal.ReleaseComObject(iShellExtInit);
                    Marshal.Release(iShellExtInitPtr);
                    pidlFull.Free();

                    return true;
                }
                else
                {
                    if (iContextMenu != null)
                    {
                        Marshal.ReleaseComObject(iContextMenu);
                        iContextMenu = null;
                    }

                    if (iContextMenuPtr != IntPtr.Zero)
                    {
                        Marshal.Release(iContextMenuPtr);
                        iContextMenuPtr = IntPtr.Zero;
                    }

                    return false;
                }
            }
            else
            {
                iContextMenuPtr = IntPtr.Zero;
                iContextMenu = null;
                return false;
            }
        }
开发者ID:AdvSofTech,项目名称:BackupWiz,代码行数:53,代码来源:BrowserContextMenuWrappers.cs


示例16: GetListViewItem

        private ListViewItem GetListViewItem(string[] subItems, ShellItem shellItem)
        {
            ListViewItem listItem = new ListViewItem(shellItem.Text, shellItem.ImageIndex);
            listItem.Name = listItem.Text;
            listItem.Tag = shellItem;

            provider.ProviderItem = shellItem;

            if (shellItem.CanRead)
            {
                if (shellItem.IsFolder)
                {
                    #region Folder Info

                    for (int i = 1; i < fileView.Columns.Count; i++)
                    {
                        IColumnPlugin plugin = fileView.Columns[i].Tag as IColumnPlugin;

                        try
                        {
                            subItems[i - 1] = plugin.GetFolderInfo(
                                provider,
                                fileView.Columns[i].Text,
                                shellItem);
                        }
                        catch (Exception)
                        {
                            subItems[i - 1] = string.Empty;
                        }
                    }

                    provider.ReleaseStorage();

                    #endregion
                }
                else
                {
                    #region File Info

                    for (int i = 1; i < fileView.Columns.Count; i++)
                    {
                        IColumnPlugin plugin = fileView.Columns[i].Tag as IColumnPlugin;

                        try
                        {
                            subItems[i - 1] = plugin.GetFileInfo(
                                provider,
                                fileView.Columns[i].Text,
                                shellItem);
                        }
                        catch (Exception)
                        {
                            subItems[i - 1] = string.Empty;
                        }
                    }

                    provider.ReleaseStream();

                    #endregion
                }
            }
            else
            {
                for (int i = 1; i < fileView.Columns.Count; i++)
                {
                    subItems[i - 1] = string.Empty;
                }
            }

            provider.ProviderItem = null;
            listItem.SubItems.AddRange(subItems);
            return listItem;
        }
开发者ID:davidcon,项目名称:ScreenGrab,代码行数:73,代码来源:Browser.cs


示例17: GetIDropTarget

        /// <summary>
        /// This method will use the GetUIObjectOf method of IShellFolder to obtain the IDropTarget of a
        /// ShellItem. 
        /// </summary>
        /// <param name="item">The item for which to obtain the IDropTarget</param>
        /// <param name="dropTargetPtr">A pointer to the returned IDropTarget</param>
        /// <returns>the IDropTarget from the ShellItem</returns>
        public static bool GetIDropTarget(ShellItem item, out IntPtr dropTargetPtr, out ShellDll.IDropTarget dropTarget)
        {
            ShellItem parent = item.ParentItem != null ? item.ParentItem : item;

            if (parent.ShellFolder.GetUIObjectOf(
                    IntPtr.Zero,
                    1,
                    new IntPtr[] { item.PIDLRel.Ptr },
                    ref ShellAPI.IID_IDropTarget,
                    IntPtr.Zero,
                    out dropTargetPtr) == ShellAPI.S_OK)
            {
                dropTarget =
                    (ShellDll.IDropTarget)Marshal.GetTypedObjectForIUnknown(dropTargetPtr, typeof(ShellDll.IDropTarget));

                return true;
            }
            else
            {
                dropTarget = null;
                dropTargetPtr = IntPtr.Zero;
                return false;
            }
        }
开发者ID:Alenochka17,项目名称:laba3,代码行数:31,代码来源:ShellHelper.cs


示例18: InitBaseItems

        /// <summary>
        /// Initialises the base ShellItems, including the Desktop and all it's children and the children of My Computer.
        /// These items are also added to the TreeView and the navigation bar.
        /// </summary>
        private void InitBaseItems()
        {
            if (ShellBrowser == null)
                ShellBrowser = new ShellBrowser();

            desktopNode = new TreeNode(
                ShellBrowser.DesktopItem.Text,
                ShellBrowser.DesktopItem.ImageIndex,
                ShellBrowser.DesktopItem.SelectedImageIndex);
            desktopNode.Tag = ShellBrowser.DesktopItem;
            desktopNode.Name = desktopNode.Text;

            folderView.Nodes.Add(desktopNode);
            navAddressBox.Items.Clear();
            navAddressBox.Items.Add(new BrowserComboItem(ShellBrowser.DesktopItem, 0));

            navAddressBox.CurrentItem = (BrowserComboItem)navAddressBox.Items[0];
            selectedNode = desktopNode;
            selectedItem = ShellBrowser.DesktopItem;

            ShellBrowser.DesktopItem.Expand(false, true, IntPtr.Zero);

            foreach (ShellItem desktopChild in ShellBrowser.DesktopItem.SubFolders)
            {
                TreeNode desktopChildNode = new TreeNode(
                    desktopChild.Text,
                    desktopChild.ImageIndex,
                    desktopChild.SelectedImageIndex);
                desktopChildNode.Tag = desktopChild;
                desktopChildNode.Name = desktopChildNode.Text;

                navAddressBox.Items.Add(new BrowserComboItem(desktopChild, 1));

                if (desktopChildNode.Text == ShellBrowser.MyComputerName)
                {
                    myCompNode = desktopChildNode;
                    desktopChild.Expand(false, true, IntPtr.Zero);

                    foreach (ShellItem myCompChild in desktopChild.SubFolders)
                    {
                        TreeNode myCompChildNode = new TreeNode(
                            myCompChild.Text,
                            myCompChild.ImageIndex,
                            myCompChild.SelectedImageIndex);
                        myCompChildNode.Tag = myCompChild;
                        myCompChildNode.Name = myCompChildNode.Text;

                        if (myCompChild.HasSubfolder)
                            myCompChildNode.Nodes.Add(string.Empty);

                        navAddressBox.Items.Add(new BrowserComboItem(myCompChild, 2));
                        desktopChildNode.Nodes.Add(myCompChildNode);
                    }
                }
                else if (desktopChild.HasSubfolder)
                    desktopChildNode.Nodes.Add(string.Empty);

                desktopNode.Nodes.Add(desktopChildNode);
            }
        }
开发者ID:davidcon,项目名称:ScreenGrab,代码行数:64,代码来源:Browser.cs


示例19: GetIQueryInfo

        public static bool GetIQueryInfo(ShellItem item, out IntPtr iQueryInfoPtr, out IQueryInfo iQueryInfo)
        {
            ShellItem parent = item.ParentItem != null ? item.ParentItem : item;

            if (parent.ShellFolder.GetUIObjectOf(
                    IntPtr.Zero,
                    1,
                    new IntPtr[] { item.PIDLRel.Ptr },
                    ref ShellAPI.IID_IQueryInfo,
                    IntPtr.Zero,
                    out iQueryInfoPtr) == ShellAPI.S_OK)
            {
                iQueryInfo =
                    (IQueryInfo)Marshal.GetTypedObjectForIUnknown(iQueryInfoPtr, typeof(IQueryInfo));

                return true;
            }
            else
            {
                iQueryInfo = null;
                iQueryInfoPtr = IntPtr.Zero;
                return false;
            }
        }
开发者ID:Alenochka17,项目名称:laba3,代码行数:24,代码来源:ShellHelper.cs


示例20: SetNewPath

        /// <summary>
        /// When a new directory is selected, this method is called to clear the ListView and fill it with
        /// the contents of the new directory
        /// </summary>
        /// <param name="oldItem">The ShellItem of the previous selected directory</param>
        /// <param name="newItem">The ShellItem of the new selected directory</param>
        private bool SetNewPath(ShellItem oldItem, ShellItem newItem)
        {
            Cursor.Current = Cursors.WaitCursor;

            if (oldItem != newItem && newItem.Expand(true, false, Handle))
            {
                ShellBrowser.UpdateCondition.ContinueUpdate = false;

                fileView.BeginUpdate();
                fileView.Items.Clear();
                fileView.ClearSelections();

                if (oldItem != null)
                {
                    bool used = false;
                    foreach (Browser br in ShellBrowser.Browsers)
                    {
                        if (!this.Equals(br) && oldItem.Equals(br.SelectedItem))
                        {
                            used = true;
                            break;
                        }
                    }

                    if (!used)
                        oldItem.Clear(true, false);
                }

                selectedItem = newItem;

                ListViewItem[] newListItemsArray = new ListViewItem[newItem.Count];
                string[] subItems = new string[fileView.Columns.Count - 1];
                for (int i = 0; i < newListItemsArray.Length; i++)
                {
                    newListItemsArray[i] = GetListViewItem(subItems, newItem[i]);
                }
                fileView.SetSorting(true);
                fileView.Items.AddRange(newListItemsArray);
                fileView.SetSorting(false);

                fileView.EndUpdate();

                Cursor.Current = Cursors.Default;
                return true;
            }
            else
            {
                Cursor.Current = Cursors.Default;
                return (oldItem == newItem);
            }
        }
开发者ID:davidcon,项目名称:ScreenGrab,代码行数:57,代码来源:Browser.cs



注:本文中的ShellDll.ShellItem类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MSSQL.Field类代码示例发布时间:2022-05-26
下一篇:
C# Sharpen.OutputStream类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap