当前位置: 首页>>代码示例>>C#>>正文


C# IShellFolder.GetDisplayNameOf方法代码示例

本文整理汇总了C#中IShellFolder.GetDisplayNameOf方法的典型用法代码示例。如果您正苦于以下问题:C# IShellFolder.GetDisplayNameOf方法的具体用法?C# IShellFolder.GetDisplayNameOf怎么用?C# IShellFolder.GetDisplayNameOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IShellFolder的用法示例。


在下文中一共展示了IShellFolder.GetDisplayNameOf方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetChilds

        private static void GetChilds(IShellFolder desktop)
        {
            Console.WriteLine("===============GetChilds================");

            //循环查找子项
            Microsoft.WindowsAPICodePack.Shell.IEnumIDList Enum = null;
            IEnumIDList EnumPtr;
            IntPtr pidlSub;
            uint celtFetched;

            if (desktop.EnumObjects(IntPtr.Zero, ShellNativeMethods.ShellFolderEnumerationOptions.Folders | ShellNativeMethods.ShellFolderEnumerationOptions.IncludeHidden | ShellNativeMethods.ShellFolderEnumerationOptions.Storage, out EnumPtr) == CONST.S_OK)
            {
                while (EnumPtr.Next(1, out pidlSub, out celtFetched) == 0 && celtFetched == CONST.S_FALSE)
                {
                    IntPtr strr;
                    desktop.GetDisplayNameOf(ref pidlSub, (uint)SHGNO.INFOLDER, out strr);
                    string name = Marshal.PtrToStringAuto(strr);

                    //SHFILEINFO info = new SHFILEINFO();
                    //Shell32.SHGetFileInfo(pidlSub, 0, ref info, Marshal.SizeOf(typeof(SHFILEINFO)), SHGFI.PIDL | SHGFI.DISPLAYNAME | SHGFI.ICONLOCATION);

                    //IShellFolder iSub;
                    //desktop.BindToObject(pidlSub, IntPtr.Zero, ref Guids.IID_IShellFolder, out iSub);

                    Console.WriteLine(name);
                }
            }
            Console.WriteLine();
            Console.WriteLine();
        }
开发者ID:uonun,项目名称:TaggableShell,代码行数:30,代码来源:Program.cs

示例2: GetNameByIShell

 /// <summary>
 /// 获取显示名称
 /// </summary>
 public static string GetNameByIShell(IShellFolder Root, IntPtr pidlSub)
 {
     IntPtr strr = Marshal.AllocCoTaskMem(MAX_PATH * 2 + 4);
     Marshal.WriteInt32(strr, 0, 0);
     StringBuilder buf = new StringBuilder(MAX_PATH);
     Root.GetDisplayNameOf(pidlSub, SHGNO.INFOLDER, strr);
     Shlwapi.StrRetToBuf(strr, pidlSub, buf, MAX_PATH);
     return buf.ToString();
 }
开发者ID:uonun,项目名称:TaggableShell,代码行数:12,代码来源:ShellExtension.cs

示例3: CheckDisplayName

 private static bool CheckDisplayName(IShellFolder shellFolder, IntPtr pIDLLast, Regex re) {
     if(pIDLLast != IntPtr.Zero) {
         STRRET strret;
         uint uFlags = 0;
         StringBuilder pszBuf = new StringBuilder(260);
         if(shellFolder.GetDisplayNameOf(pIDLLast, uFlags, out strret) == 0) {
             PInvoke.StrRetToBuf(ref strret, pIDLLast, pszBuf, pszBuf.Capacity);
         }
         if(pszBuf.Length > 0) {
             return re.IsMatch(pszBuf.ToString());
         }
     }
     return false;
 }
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:14,代码来源:QTButtonBar.cs

示例4: GetDisplayName

 public static string GetDisplayName(IShellFolder shellFolder, IntPtr pIDLLast, bool fDisplayName) {
     STRRET strret;
     uint uFlags = fDisplayName ? 0 : 0x8000u;
     StringBuilder pszBuf = new StringBuilder(260);
     if(shellFolder.GetDisplayNameOf(pIDLLast, uFlags, out strret) == 0) {
         PInvoke.StrRetToBuf(ref strret, pIDLLast, pszBuf, pszBuf.Capacity);
     }
     return pszBuf.ToString();
 }
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:9,代码来源:ShellMethods.cs

示例5: ExtractDisplayName

 public static string ExtractDisplayName( IShellFolder shellFolder,  IntPtr pidlRelative, IntPtr pidlAbsolute )
 {
     try
     {
         STRRET ptrString;
         shellFolder.GetDisplayNameOf( pidlRelative,
             (uint)SHGDN.SHGDN_NORMAL, out ptrString );
         StringBuilder strDisplay = new StringBuilder( (int)MAX.PATH );
         StrRetToBuf( ref ptrString, pidlAbsolute, strDisplay, (uint)strDisplay.Capacity );
         return strDisplay.ToString( );
     }
     catch
     {
         throw;
     }
 }
开发者ID:sato1043,项目名称:SAITextureChanger,代码行数:16,代码来源:Win32_Shell.cs

示例6: GetAbsolutePidl

 private static IntPtr GetAbsolutePidl(IShellFolder folder, IntPtr relativePidl)
 {
     IntPtr ptr;
     IShellFolder desktopFolder = GetDesktopFolder();
     try
     {
         string lpszDisplayName = folder.GetDisplayNameOf(relativePidl, SHGNO.SHGDN_FORPARSING);
         ptr = desktopFolder.ParseDisplayName(IntPtr.Zero, lpszDisplayName);
     }
     finally
     {
         Marshal.ReleaseComObject(desktopFolder);
     }
     return ptr;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:15,代码来源:ShellItem.cs


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