int GetMenuString(hmenu, idItem, lpsz, cbMax, fwFlags) | |||||
HMENU hmenu; | /* handle of menu, */ | ||||
UINT idItem; | /* menu-item identifier, */ | ||||
LPSTR lpsz; | /* address of buffer for label | */ | |||
int cbMax; | /* maximum length of label | */ | |||
UINT fwFlags; | /* menu flags, */ |
The GetMenuString function copies the label of a menu item into a buffer.
hmenu
Identifies the menu.
idItem
Specifies the menu item whose label is to be copied, as determined by the fwFlags parameter.
lpsz
Points to a buffer that will receive the null-terminated label string.
cbMax
Specifies the maximum length, in bytes, of the label string. The label string is truncated if it is longer.
fwFlags
Specifies the nature of the idItem parameter. It can be one of the following values:
Value | Meaning |
MF_BYCOMMAND | Specifies the menu-item identifier. |
MF_BYPOSITION | Specifies the zero-based position of the menu item. |
The return value is the length, in bytes, of the returned label, if the function is successful. The length does not include the terminating null character.
The cbMax parameter should be one larger than the number of characters in the label to accommodate the null character that terminates the string.