Author Topic: MENUITEMINFO  (Read 2977 times)

minor28

  • Member
  • **
  • Posts: 107
    • Minor28 DivDev
MENUITEMINFO
« on: September 29, 2014, 11:03:35 PM »
Windows.inc
Code: [Select]
MENUITEMINFOA STRUCT
  cbSize        DWORD      ?
  fMask         DWORD      ?
  fType         DWORD      ?
  fState        DWORD      ?
  wID           DWORD      ?
  hSubMenu      DWORD      ?
  hbmpChecked   DWORD      ?
  hbmpUnchecked DWORD      ?
  dwItemData    DWORD      ?
  dwTypeData    DWORD      ?
  cch           DWORD      ?
MENUITEMINFOA ENDS

http://msdn.microsoft.com/en-us/library/windows/desktop/ms647578(v=vs.85).aspx
Code: [Select]
typedef struct tagMENUITEMINFO {
  UINT      cbSize;
  UINT      fMask;
  UINT      fType;
  UINT      fState;
  UINT      wID;
  HMENU     hSubMenu;
  HBITMAP   hbmpChecked;
  HBITMAP   hbmpUnchecked;
  ULONG_PTR dwItemData;
  LPTSTR    dwTypeData;
  UINT      cch;
  HBITMAP   hbmpItem;
} MENUITEMINFO, *LPMENUITEMINFO;

Is windnows.inc missing hbmpItem?
This and that on my site

jj2007

  • Member
  • *****
  • Posts: 7542
  • Assembler is fun ;-)
    • MasmBasic
Re: MENUITEMINFO
« Reply #1 on: September 29, 2014, 11:20:25 PM »
Is windows.inc missing hbmpItem?

That's the purpose of cbSize: tell Windows which version you are using.
hbmpItem is not essential and was introduced a bit later.

minor28

  • Member
  • **
  • Posts: 107
    • Minor28 DivDev
Re: MENUITEMINFO
« Reply #2 on: September 30, 2014, 07:32:41 AM »
Yes it is true, but if I tell Windows that I want the newer version then it does not exist in windows.inc
This and that on my site

dedndave

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: MENUITEMINFO
« Reply #3 on: September 30, 2014, 10:41:35 AM »
so, define your own structure
Code: [Select]
MENUITEMINFO2
  MENUITEMINFO <>
  hbmpItem     HBITMAP ?
MENUITEMINFO2

ToutEnMasm

  • Member
  • *****
  • Posts: 1189
    • EditMasm
Re: MENUITEMINFO
« Reply #4 on: October 02, 2014, 05:33:15 PM »

Only the translated sdk allow this form
Quote
MENUITEMINFOA   STRUCT DEFALIGNMASM
   cbSize DWORD ?
   fMask DWORD ?
   fType DWORD ? ; used if MIIM_TYPE (4.0) or MIIM_FTYPE (>4.0)
   fState DWORD ? ; used if MIIM_STATE
   wID DWORD ? ; used if MIIM_ID
   hSubMenu DWORD ? ; used if MIIM_SUBMENU
   hbmpChecked DWORD ? ; used if MIIM_CHECKMARKS
   hbmpUnchecked DWORD ? ; used if MIIM_CHECKMARKS
   dwItemData ULONG_PTR ? ; used if MIIM_DATA
   dwTypeData DWORD ? ; used if MIIM_TYPE (4.0) or MIIM_STRING (>4.0)
   cch DWORD ? ; used if MIIM_TYPE (4.0) or MIIM_STRING (>4.0)
IF ( WINVER GE 00500h)
   hbmpItem DWORD ? ; used if MIIM_BITMAP
ENDIF ;/* WINVER >= 0x0500 */
MENUITEMINFOA      ENDS

Like this you have the right structure with the correct alignment
Fa is a musical note to play with CL

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4807
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: MENUITEMINFO
« Reply #5 on: October 02, 2014, 07:19:27 PM »
This will always be the case as Microsoft keep adding things to the API and support structures and equates. If a version does not do what you require because a later version has been aded by Microsoft, simply define your own. Call it something slightly different so that if and when the master include file is updated, it will not clash with it.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

jj2007

  • Member
  • *****
  • Posts: 7542
  • Assembler is fun ;-)
    • MasmBasic
Re: MENUITEMINFO
« Reply #6 on: October 02, 2014, 07:56:12 PM »
simply define your own

Yes indeed. Dave's suggestion is simple and straightforward :t

so, define your own structure
Code: [Select]
MENUITEMINFO2
  MENUITEMINFO <>
  hbmpItem     HBITMAP ?
MENUITEMINFO2

dedndave

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: MENUITEMINFO
« Reply #7 on: October 02, 2014, 08:09:35 PM »
i guess mine is less than ideal
if Hutch changes the structure in windows.inc, it will break the code   :(

jj2007

  • Member
  • *****
  • Posts: 7542
  • Assembler is fun ;-)
    • MasmBasic
Re: MENUITEMINFO
« Reply #8 on: October 03, 2014, 04:10:42 AM »
if Hutch changes the structure in windows.inc, it will break the code   :(

ifndef helps:

include \masm32\include\masm32rt.inc

MyRECT struct
  RECT <>
  ifndef RECT.left
   left dd ?
  endif
  ifndef OneMore
   OneMore   dd ?
  endif
MyRECT ends

.code
therect MyRECT <<1, 2, 3, 4>, 5>

start:
   print str$(therect.left), 9, "left", 13, 10
   print str$(therect.top), 9, "top", 13, 10
   print str$(therect.right), 9, "right", 13, 10
   print str$(therect.bottom), 9, "bottom", 13, 10
   inkey str$(therect.OneMore), 9, "onemore", 13, 10
   exit

end start