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)); }
private ShellItemImpl GetParent() { var pidl = Shell32.ILClone(Pidl); if (Shell32.ILRemoveLastID(pidl)) { return(new ShellItemImpl(pidl, true)); } return(this); }
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); }
ShellItemImpl GetParent() { IntPtr pidl = Shell32.ILClone(m_Pidl); if (Shell32.ILRemoveLastID(pidl)) { return(new ShellItemImpl(pidl, true)); } else { return(this); } }
private ShellItemImpl GetParent() { IntPtr pidl = Shell32.ILClone(Pidl); return(Shell32.ILRemoveLastID(pidl) ? new ShellItemImpl(pidl, true) : this); }