/// <summary>
        /// Read the menu item collection.
        /// </summary>
        /// <param name="lpRes">Address in memory.</param>
        /// <returns>End of the menu item structure.</returns>
        internal IntPtr Read(IntPtr lpRes)
        {
            while (true)
            {
                lpRes = ResourceUtil.Align(lpRes.ToInt64());

                User32.MENUEXITEMTEMPLATE childItem = (User32.MENUEXITEMTEMPLATE)Marshal.PtrToStructure(
                    lpRes, typeof(User32.MENUEXITEMTEMPLATE));

                MenuExTemplateItem childMenu = null;
                if ((childItem.bResInfo & (uint)User32.MenuResourceType.Sub) > 0)
                {
                    childMenu = new MenuExTemplateItemPopup();
                }
                else
                {
                    childMenu = new MenuExTemplateItemCommand();
                }

                lpRes = childMenu.Read(lpRes);
                Add(childMenu);

                if ((childItem.bResInfo & (uint)User32.MenuResourceType.Last) > 0)
                {
                    break;
                }
            }

            return(lpRes);
        }
        /// <summary>
        /// Read the menu item collection.
        /// </summary>
        /// <param name="lpRes">Address in memory.</param>
        /// <returns>End of the menu item structure.</returns>
        internal IntPtr Read(IntPtr lpRes)
        {
            _dwContextHelpID = (UInt32)Marshal.ReadInt32(lpRes);
            lpRes            = new IntPtr(lpRes.ToInt32() + 4);

            while (true)
            {
                User32.MENUEXITEMTEMPLATE childItem = (User32.MENUEXITEMTEMPLATE)Marshal.PtrToStructure(
                    lpRes, typeof(User32.MENUEXITEMTEMPLATE));

                MenuExTemplateItem childMenu = null;
                if (childItem.dwOptions == (uint)User32.MenuResourceType.Sub)
                {
                    childMenu = new MenuExTemplateItemPopup();
                }
                else
                {
                    childMenu = new MenuExTemplateItemCommand();
                }

                lpRes = childMenu.Read(lpRes);
                Add(childMenu);

                if (childItem.dwOptions == (uint)User32.MenuResourceType.Last)
                {
                    break;
                }
            }

            return(lpRes);
        }