public HResult GetParent(out IShellItem ppsi) { IntPtr pidl = Shell32.ILClone(Pidl); if (Shell32.ILRemoveLastID(pidl)) { ppsi = new ShellItemImpl(pidl, true); return HResult.S_OK; } else { ppsi = null; return HResult.MK_E_NOOBJECT; } }
public ShellItem(ShellItem parent, IntPtr pidl) { if (RunningVista) { ComInterface = Shell32.SHCreateItemWithParent(IntPtr.Zero, parent.GetIShellFolder(), pidl, typeof(IShellItem).GUID); } else { Interop.VistaBridge.ShellItemImpl impl = (Interop.VistaBridge.ShellItemImpl)parent.ComInterface; ComInterface = new Interop.VistaBridge.ShellItemImpl(Shell32.ILCombine(impl.Pidl, pidl), true); } Constructor_Helper(); }
public HResult GetParent(out IShellItem ppsi) { IntPtr pidl = Shell32.ILClone(m_Pidl); if (Shell32.ILRemoveLastID(pidl)) { ppsi = new ShellItemImpl(pidl, true); return(HResult.S_OK); } else { ppsi = null; return(HResult.MK_E_NOOBJECT); } }
public int Compare(IShellItem psi, SICHINT hint) { var other = (ShellItemImpl)psi; ShellItemImpl myParent = GetParent(); ShellItemImpl theirParent = other.GetParent(); if (Shell32.ILIsEqual(myParent.Pidl, theirParent.Pidl)) { return(myParent.GetIShellFolder().CompareIDs((SHCIDS)hint, Shell32.ILFindLastID(Pidl), Shell32.ILFindLastID(other.Pidl))); } else { return(1); } }
static IShellItem CreateItemWithParent(ShellItem parent, IntPtr pidl) { if (RunningVista) { return(Shell32.SHCreateItemWithParent(IntPtr.Zero, parent.GetIShellFolder(), pidl, typeof(IShellItem).GUID)); } else { Interop.VistaBridge.ShellItemImpl impl = (Interop.VistaBridge.ShellItemImpl)parent.ComInterface; return(new Interop.VistaBridge.ShellItemImpl( Shell32.ILCombine(impl.Pidl, pidl), true)); } }