Example #1
0
        public IntPtr GetDisplayName(SIGDN sigdnName)
        {
            if (sigdnName == SIGDN.FILESYSPATH)
            {
                StringBuilder result = new StringBuilder(512);
                if (!Shell32.SHGetPathFromIDList(m_Pidl, result))
                {
                    throw new ArgumentException();
                }
                return(Marshal.StringToHGlobalUni(result.ToString()));
            }
            else
            {
                IShellFolder  parentFolder = GetParent().GetIShellFolder();
                IntPtr        childPidl    = Shell32.ILFindLastID(m_Pidl);
                StringBuilder builder      = new StringBuilder(512);
                STRRET        strret       = new STRRET();

                parentFolder.GetDisplayNameOf(childPidl,
                                              (SHGNO)((int)sigdnName & 0xffff), out strret);
                ShlWapi.StrRetToBuf(ref strret, childPidl, builder,
                                    (uint)builder.Capacity);
                return(Marshal.StringToHGlobalUni(builder.ToString()));
            }
        }