MENUITEMINFO Structure

Type MENUITEMINFO
	cbSize As Long
	fMask As Long
	fType As Long
	fState As Long
	wID As Long
	hSubMenu As Long
	hbmpChecked As Long
	hbmpUnchecked As Long
	dwItemData As Long
	dwTypeData As String
	cch As Long
End Type

Description & Usage

The MENUITEMINFO structure holds information that describes a menu item. This description includes the text of the item, its state (enabled, gray, etc.), and other things relating to its appearance.

Visual Basic-Specific Issues

If you need to set dwTypeData to a handle to a bitmap, a slight modification to the above structure definition must be made. Change the type of the dwTypeData data member from "As String" to "As Long". With that change made, it can now be set to a bitmap handle.

Data Members

cbSize
The size, in bytes, of the structure.
fMask
A combination of the following flags specifying which parts of the structure to use. Any other data members not specified by a flag will be ignored.
MIIM_STATE
Use the fState data member.
MIIM_ID
Use the wID data member.
MIIM_SUBMENU
Use the hSubMenu data member.
MIIM_CHECKMARKS
Use the hbmpChecked and hbmpUnchecked data members.
MIIM_DATA
Use the dwItemData data member.
MIIM_TYPE
Use the dwTypeData and cch data members.
fType
A combination of the following flags specifying the type of menu item the structure describes:
MFT_BITMAP
The menu item is displayed using a bitmap. dwTypeData is a handle to the bitmap to use, and cch is ignored. This flag cannot be combined with MFT_SEPARATOR or MFT_STRING.
MFT_MENUBARBREAK
Place this item on a new row (for a menu bar) or column (for a drop-down menu, submenu, or context menu). If starting a new column, separate the two columns by a vertical line.
MFT_MENUBREAK
Same as MFT_MENUBARBREAK, but do not draw a line separating the two columns.
MFT_OWNERDRAW
Make the menu item owner-drawn. This makes the owning window completely responsible for drawing the menu item whenever necessary.
MFT_RADIOCHECK
When checked, place a radio-button mark instead of a check mark next to the menu item. This signifies a radio-button-type menu item.
MFT_RIGHTJUSTIFY
For menu bars only, right-justify this item and all other items after it.
MFT_RIGHTORDER
Windows 95, 98, 2000: The menus cascade from right to left, supporting languages that are read from right to left.
MFT_SEPARATOR
The menu item is a separator bar. dwTypeData and cch are ignored. This flag cannot be combined with MFT_BITMAP or MFT_STRING.
MFT_STRING
The menu item is represented by a text string (which may or may not be checked or have a submenu attached). dwTypeData is the string to display for the menu item, and cch is the string's length. This flag cannot be combined with MFT_BITMAP or MFT_SEPARATOR.
fState
A combination of the following flags specifying the menu item's current state:
MFS_CHECKED
A check mark (or radio-button mark) appears next to the menu item.
MFS_DEFAULT
This item is the default selection for the menu.
MFS_DISABLED
The menu item is disabled. Although it is displayed normally, the user cannot select it.
MFS_ENABLED
The menu item is enabled.
MFS_GRAYED
The menu item is grayed out. The user cannot select it.
MFS_HILITE
The menu item currently has the selection highlight.
MFS_UNCHECKED
No check mark (or radio-button mark) appears next to the menu item.
MFS_UNHILITE
The menu item does not currently have the selection highlight.
wID
The unique 16-bit identifier of the menu item.
hSubMenu
A handle to the submenu that opens when the menu item is selected.
hbmpChecked
A handle to the bitmap to display next to the menu item when the item is checked. The bitmap's colors will be inverted when the selection highlight moves over the item.
hbmpUnchecked
A handle to the bitmap to display next to the menu item when the item is not checked. The bitmap's colors will be inverted when the selection highlight moves over the item.
dwItemData
Program-defined information to associate with the menu item. This information is not used by Windows.
dwTypeData
If fType contains MFT_STRING, this is the string to display for the menu item. If fType contains MFT_BITMAP, this is a handle to the bitmap used to represent the menu item.
cch
If dwTypeData is a string, this is the number of characters in that string.

Constant Definitions

Const MIIM_STATE = &H1
Const MIIM_ID = &H2
Const MIIM_SUBMENU = &H4
Const MIIM_CHECKMARKS = &H8
Const MIIM_DATA = &H20
Const MIIM_TYPE = &H10
Const MFT_BITMAP = &H4
Const MFT_MENUBARBREAK = &H20
Const MFT_MENUBREAK = &H40
Const MFT_OWNERDRAW = &H100
Const MFT_RADIOCHECK = &H200
Const MFT_RIGHTJUSTIFY = &H4000
Const MFT_RIGHTORDER = &H2000
Const MFT_SEPARATOR = &H800
Const MFT_STRING = &H0
Const MFS_CHECKED = &H8
Const MFS_DEFAULT = &H1000
Const MFS_DISABLED = &H2
Const MFS_ENABLED = &H0
Const MFS_GRAYED = &H1
Const MFS_HILITE = &H80
Const MFS_UNCHECKED = &H0
Const MFS_UNHILITE = &H0

Used By

GetMenuItemInfo, InsertMenuItem, SetMenuItemInfo

Back to the Structure list.
Back to the Reference section.


Last Modified: June 4, 2000
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/m/menuiteminfo.html