コード例 #1
0
        private Uri GetShellUri(IntPtr pidl, bool free)
        {
            Stack <string> list;
            IntPtr         pidlrel = free ? pidl : Shell32.ILClone(pidl);

            try{
                list = new Stack <string>();

                while (true)
                {
                    string name = Shell32.SHGetNameFromIDList(pidlrel, SIGDN.SIGDN_PARENTRELATIVEPARSING);
                    if (!Shell32.ILRemoveLastID(pidlrel))
                    {
                        break;                                                      //TODO check if really desktop
                    }
                    list.Push(name);
                }
            }finally{
                Marshal.FreeCoTaskMem(pidlrel);
            }

            string path = String.Join("/", list.Select(n => HttpUtility.UrlEncode(n)));

            return(GetShellUri(path));
        }
コード例 #2
0
        private ShellItemImpl GetParent()
        {
            var pidl = Shell32.ILClone(Pidl);

            if (Shell32.ILRemoveLastID(pidl))
            {
                return(new ShellItemImpl(pidl, true));
            }
            return(this);
        }
コード例 #3
0
        public HResult GetParent(out IShellItem ppsi)
        {
            var pidl = Shell32.ILClone(Pidl);

            if (Shell32.ILRemoveLastID(pidl))
            {
                ppsi = new ShellItemImpl(pidl, true);
                return(HResult.S_OK);
            }
            ppsi = null;
            return(HResult.MK_E_NOOBJECT);
        }
コード例 #4
0
        ShellItemImpl GetParent()
        {
            IntPtr pidl = Shell32.ILClone(m_Pidl);

            if (Shell32.ILRemoveLastID(pidl))
            {
                return(new ShellItemImpl(pidl, true));
            }
            else
            {
                return(this);
            }
        }
コード例 #5
0
        private ShellItemImpl GetParent()
        {
            IntPtr pidl = Shell32.ILClone(Pidl);

            return(Shell32.ILRemoveLastID(pidl) ? new ShellItemImpl(pidl, true) : this);
        }