public unsafe string ToString(ItemIdList pidl) { if (_pointer == IntPtr.Zero) { throw new ObjectDisposedException(nameof(ReturnString)); } string result = null; STRRET *s = (STRRET *)_pointer.ToPointer(); switch (s->uType) { case STRRET.STRRET_TYPE.STRRET_WSTR: result = new string(s->Data.pOleStr); break; case STRRET.STRRET_TYPE.STRRET_CSTR: // https://docs.microsoft.com/en-us/windows/desktop/api/shlwapi/nf-shlwapi-shansitounicode throw new NotSupportedException(); case STRRET.STRRET_TYPE.STRRET_OFFSET: // https://docs.microsoft.com/en-us/windows/desktop/api/shlwapi/nf-shlwapi-shansitounicode throw new NotSupportedException(); default: throw new InvalidOperationException(); } return(result); }
/// <summary> /// Get the name for a given Shell item ID. /// </summary> public static string GetNameFromId(ItemIdList id, SIGDN form = SIGDN.NORMALDISPLAY) { HRESULT hr = Imports.SHGetNameFromIDList(id, form, out string name); if (hr != HRESULT.S_OK) { throw Errors.GetIoExceptionForHResult(hr); } return(name); }
public static extern HResult SHGetNameFromIDList( ItemIdList pidl, ShellItemDisplayNames sigdnName, out string ppszName);
public static extern HResult SHGetKnownFolderIDList( ref Guid rfid, KnownFolderFlags dwFlags, SafeHandle hToken, out ItemIdList ppidl);
public unsafe static extern bool SHGetPathFromIDListEx( ItemIdList pidl, char *pszPath, uint cchPath, uint uOpts);
/// <summary> /// Get the name for a given Shell item ID. /// </summary> public static string GetNameFromId(ItemIdList id, ShellItemDisplayNames form = ShellItemDisplayNames.NormalDisplay) { Imports.SHGetNameFromIDList(id, form, out string name).ThrowIfFailed(); return(name); }
public static extern HRESULT SHGetNameFromIDList( ItemIdList pidl, SIGDN sigdnName, out string ppszName);
public static extern HRESULT SHGetKnownFolderIDList( [MarshalAs(UnmanagedType.LPStruct)] Guid rfid, KNOWN_FOLDER_FLAG dwFlags, SafeHandle hToken, out ItemIdList ppidl);