
Querying menu objects
TMenu has a number of member functions and member operators you can
call to find out information about the menu object and its menu. Y u mighto
need to call one of the query member functions before you call one of the
modify member functions. For example, you need to call
GetMenuCheckmarkDimensions before calling SetMenuItemBitmaps.
The table below lists the menu-object query member functions:
__________________________________________________________________________
Table 7.3
TMenu
member function Description
____________________________________________________________________
TMenu member
functions for querying
Querying the menu object as a whole:
menu objects
operator
UINT()
and Returns the menu’ handle.s
operator
HMENU()
IsOK()
Checks if the menu is OK (has a valid handle).
GetMenuItemCount()
Returns the number of items in the menu.
GetMenuCheckMarkDimensions(TSize&)
Gets the size of the bitmap used to display the
check mark on checked menu items.
Querying items in the menu:
GetMenuItemID(int)
Returns the ID of the menu item at the specified
position.
GetMenuState(UINT UINT)
Returns the state flags of the specified menu
,
item.
GetMenuString(UINT char*, int, UINT)
Gets the text of the given menu item.
,
GetSubMenu(int)
Returns the handle of the menu at the given
position.
____________________________________________________________________
Using system menu objects
ObjectWindows’ TSystemMenu class lets you modify a window’ systems
menu. TSystemMenu is derived from TMenu and differs from it only in its
constructor which takes a window handle and a boolean flag. If the flag is,
TRUE, the current system menu is deleted and a menu object representing
the unmodified menu that’ put in its place is created. If the flag is FALSE,s
the menu object represents the current system menu.
Y u can use all the member functions inherited from TMenu to manipulateo
the system menu.
Chapter 7, Menu objects
173