コード例 #1
0
        /// <summary>
        /// Constructor for the desktop shell item.
        /// </summary>
        /// <param name="explorer">
        /// Explorer class that uses the shell item.
        /// </param>
        /// <param name="pidl">
        /// Pointer to the desktop PIDL.
        /// </param>
        /// <param name="folderPtr">
        /// Pointer to the IShellFolder interface for the desktop.
        /// </param>
        internal ShellItem(ShellExplorer explorer, IntPtr pidl, IntPtr folderPtr)
        {
            this.explorer  = explorer;
            parent         = null;
            this.folderPtr = folderPtr;
            // get managed object
            this.folder =
                (IShellFolder)Marshal.GetTypedObjectForIUnknown(folderPtr, typeof(IShellFolder));
            subFiles   = new ShellItemList(this);
            subFolders = new ShellItemList(this);
            relPidl    = new PIDL(pidl, false);

            text = "Desktop";
            path = "Desktop";
            SetDesktopAttributes();

            ShellAPI.SHFILEINFO info = new ShellAPI.SHFILEINFO();
            ShellAPI.SHGetFileInfo(relPidl.Ptr,
                                   0,
                                   ref info,
                                   ShellAPI.cbFileInfo,
                                   ShellAPI.SHGFI.PIDL |
                                   ShellAPI.SHGFI.TYPENAME |
                                   ShellAPI.SHGFI.SYSICONINDEX);
            type = info.szTypeName;

            ShellImageList.SetIconIndex(this, info.iIcon, false);
            ShellImageList.SetIconIndex(this, info.iIcon, true);
        }
コード例 #2
0
 /// <summary>
 /// Constructor for a folder item.
 /// </summary>
 /// <param name="explorer">
 /// Explorer class that uses the shell item.
 /// </param>
 /// <param name="parent">
 /// Parent shell item for this item.
 /// </param>
 /// <param name="pidl">
 /// Pointer to the folder PIDL.
 /// </param>
 /// <param name="folderPtr">
 /// Pointer to the IShellFolder interface for the folder.
 /// </param>
 internal ShellItem(ShellExplorer explorer, ShellItem parent, IntPtr pidl, IntPtr folderPtr)
 {
     this.explorer  = explorer;
     this.parent    = parent;
     this.folderPtr = folderPtr;
     folder         = (IShellFolder)Marshal.GetTypedObjectForIUnknown(folderPtr, typeof(IShellFolder));
     subFiles       = new ShellItemList(this);
     subFolders     = new ShellItemList(this);
     relPidl        = new PIDL(pidl, false);
     SetText();
     SetPath();
     SetInfo();
     SetFolderAttributes();
 }
コード例 #3
0
 /// <summary>
 /// Constructor for a file item.
 /// </summary>
 /// <param name="explorer">
 /// Explorer class that uses the shell item.
 /// </param>
 /// <param name="parent">
 /// Parent shell item for this item.
 /// </param>
 /// <param name="pidl">
 /// Pointer to the file PIDL.
 /// </param>
 internal ShellItem(ShellExplorer explorer, ShellItem parent, IntPtr pidl)
 {
     this.explorer = explorer;
     this.parent   = parent;
     folderPtr     = IntPtr.Zero;
     folder        = null;
     subFiles      = null;
     subFolders    = null;
     relPidl       = new PIDL(pidl, false);
     SetText();
     SetPath();
     SetInfo();
     SetFileAttributes();
 }