c++ - What is the purpose of uItem parameter in InsertMenuItem()? -
This is what insertMenuItem () documentation says:
uItem [in] type : UINT Identification item or item status which is to insert new item first. This parameter depends on the value of fByPosition. But then what is the purpose of MENUITEMINFO.wID?
wID type: UINT is an application defined value that identifies the menu item to set the FIMask to MIIM_ID to use WID Note I tested both the parameters, and only wID worked!
But then what is the purpose of MENUITEMINFO.wID?
uItem controls the location where the new menu item is inserted . Controls wID the new menu item ID .
Suppose you have a menu with 3 items identifiers IDM_FOO , IDM_BAR , and IDM_BAZ . Now suppose you want to enter the 4th item with the identifier IDM_QUUX in the menu between IDM_FOO and IDM_BAR items. You can assign it to InsertMenuItem () before either IDM_BAR (using fByPosition == FALSE ) or before index 1 ( FBIPRESS == TRUE ). For example:
MENUITEMINFO mii; Xerom (Mauri, mii); Mii.cbSize = sizeof (mii); Mii.fMask = MIIM_ID | / * Other flags * /; Mii.wID = IDM_QUUX; // fill out other fields to enter the ID of the new menu item ... // Enter the new menu item before IDM_BAR item InsertMenuItem (hMenuParent, IDM_BAR, FALSE, and mii); ... // Or, insert new menu item before Insert position 1 menu item (hMenuParent, 1, TRUE, and mii); For this comment:
Note that I tested both the parameters, and WID only worked!
You have to clarify what is meant by "working only on". How did work What did you do, what happened and what did you expect to do? Make sure that you read the documentation carefully to understand how the function and structure want to work.
Comments
Post a Comment