Menu and MenuItem
A Menu class is used to read the contents of a Windows menu. It is normally created a result of calling GetTopMenu
.
Descriptions of the Menu and MenuItem classes follow.
Menu Class
The Menu class contains the following methods and properties:
Menu(IntPtr hMenu); // construct a Menu class from the given menu window handle
HandleRef Handle; // return the window handle
IList<MenuItem> Items // get a list of MenuItems in the menu
MenuItem FindMenuItem(int[] menuPath); // Find a MenuItem from a menu path as a list of integers
// where each integer is a menu index
MenuItem FindMenuItem(string[] menuPath); // Find a MenuItem from a menu path as a list of strings.
MenuItem Class
A MenuItem class used to read an individual menu item.
It is normally created as a result of calling FindMenu()
or listing the items in a Menu class object.
The MenuItem class contains the following read-only properties:
uint ID; // the menu ID as an unsigned integer
bool IsChecked; // true if the menu item is checked
bool IsDisabled; // true if the menu item is disabled
bool IsGreyed; // true if the menu item is disabled
bool IsSeparator; // true if the item is a separator
string Name; // the text of the menu item
uint Offset;
Menu SubMenu; // any sub-menu of the item