Beispiel #1
0
        /// <summary>
        ///     Returns the name of the item in the specified style.
        /// </summary>
        /// <param name="sigdn">
        ///     The style of display name to return.
        /// </param>
        /// <returns>
        ///     A string containing the display name of the item.
        /// </returns>
        public string GetDisplayName(SIGDN sigdn)
        {
            var resultPtr = ComInterface.GetDisplayName(sigdn);
            var result    = Marshal.PtrToStringUni(resultPtr);

            Marshal.FreeCoTaskMem(resultPtr);
            return(result);
        }
Beispiel #2
0
 /// <summary>
 /// Returns the name of the item in the specified style.
 /// </summary>
 ///
 /// <param name="sigdn">
 /// The style of display name to return.
 /// </param>
 ///
 /// <returns>
 /// A string containing the display name of the item.
 /// </returns>
 public string GetDisplayName(SIGDN sigdn)
 {
     try {
         IntPtr resultPtr = ComInterface.GetDisplayName(sigdn);
         string result    = Marshal.PtrToStringUni(resultPtr);
         Marshal.FreeCoTaskMem(resultPtr);
         return(result);
     } catch {
         try {
             var    shellobj  = new ShellItem(this.CachedParsingName.ToShellParsingName());
             IntPtr resultPtr = shellobj.ComInterface.GetDisplayName(sigdn);
             string result    = Marshal.PtrToStringUni(resultPtr);
             Marshal.FreeCoTaskMem(resultPtr);
             return(result);
         } catch {
             return("Search.search-ms");
         }
     }
 }