Пример #1
0
 /// <summary>
 /// Read a menu resource.
 /// </summary>
 /// <param name="hModule">Module handle.</param>
 /// <param name="lpRes">Pointer to the beginning of a resource.</param>
 /// <returns>Pointer to the end of the resource.</returns>
 internal override IntPtr Read(IntPtr hModule, IntPtr lpRes)
 {
     UInt16 version = (UInt16) Marshal.ReadInt16(lpRes);
     switch (version)
     {
         case 0:
             _menu = new MenuTemplate();
             break;
         case 1:
             _menu = new MenuExTemplate();
             break;
         default:
             throw new NotSupportedException(string.Format(
                 "Unexpected menu header version {0}", version));
     }
     
     return _menu.Read(lpRes);
 }
Пример #2
0
        /// <summary>
        /// Read a menu resource.
        /// </summary>
        /// <param name="hModule">Module handle.</param>
        /// <param name="lpRes">Pointer to the beginning of a resource.</param>
        /// <returns>Pointer to the end of the resource.</returns>
        internal override IntPtr Read(IntPtr hModule, IntPtr lpRes)
        {
            UInt16 version = (UInt16)Marshal.ReadInt16(lpRes);

            switch (version)
            {
            case 0:
                _menu = new MenuTemplate();
                break;

            case 1:
                _menu = new MenuExTemplate();
                break;

            default:
                throw new NotSupportedException(string.Format(
                                                    "Unexpected menu header version {0}", version));
            }

            return(_menu.Read(lpRes));
        }