MENUITEMINFO (Structures)
Last changed: NetMage-165.214.11.83

.
Summary
The MENUITEMINFO structure contains information about a menu item.

C# Definition:

[StructLayout(LayoutKind.Sequential)]
struct MENUITEMINFO {
   public uint cbSize;
   public uint fMask;
   public uint fType;
   public uint fState;
   public uint wID;
   public IntPtr hSubMenu;
   public IntPtr hbmpChecked;
   public IntPtr hbmpUnchecked;
   public IntPtr dwItemData; <- ItemData is up! by haijer
   public string dwTypeData;
   public uint cch;
   public IntPtr hbmpItem;
}

VB Definition:

   <StructLayout(LayoutKind.Sequential)>
   Public Structure MENUITEMINFO
      Public cbSize As Integer
      Public fMask As Integer
      Public fType As Integer
      Public fState As Integer
      Public wID As Integer
      Public hSubMenu As IntPtr
      Public hbmpChecked As IntPtr
      Public hbmpUnchecked As IntPtr
      Public dwItemData As IntPtr
      Public dwTypeData As String
      Public cch As Integer
      Public hbmpItem As IntPtr
   End Structure

User-Defined Field Types:

None.

Notes:

The c# MENUITEMINFO struct above did not work for me and kept resulting in empty or 'separator' menu items when used in conjunction with InsertMenuItem. Using the following struct, everything seems to work fine:

[StructLayout(LayoutKind.Sequential)]

struct MENUITEMINFO

{

  public uint cbSize;
  public uint fMask;
  public uint fType;
  public uint fState;
  public int wID;
  public int /*HMENU*/ hSubMenu;
  public int /*HBITMAP*/ hbmpChecked;
  public int /*HBITMAP*/ hbmpUnchecked;
  public int /*ULONG_PTR*/ dwItemData;
  public String dwTypeData;
  public uint cch;
  public int /*HBITMAP*/ hbmpItem;

}

Documentation