/// <summary> /// Returns the next pIDL in an IEnumIDList /// </summary> /// <param name="pEnumObjects">The IEnumIDList to get the next element of</param> /// <returns>a pIDL or IntPtr.Zero in case the end of the enum is reached</returns> public static IntPtr getNextChild(Object pEnumObjects) { if (pEnumObjects == null) { return(IntPtr.Zero); } ShellApi.IEnumIDList list = (ShellApi.IEnumIDList)pEnumObjects; IntPtr pIDL = new IntPtr(); int pceltFetched; // can be ignored, if celt = 1 uint hRes = list.Next(1, out pIDL, out pceltFetched); if (hRes != 0 || pceltFetched == 0) { return(IntPtr.Zero); } else { return(pIDL); } }