APIIo_​GetMenuItemTextID

Returns the text of the specified menu item.

    GSErrCode ACAPI_Interface (
        APIIo_GetMenuItemTextID,
        const API_MenuItemRef*     menuItemRef,
        char*                      itemText,
        GS::UniString*             itemUniText
    );

 

Parameters

itemRef
[in] Identifies the menu item.
itemText
[out] Menu item text (if you don’t pass itemUniText).
itemUniText Featuring API 17
[out] Optional Unicode menu item text to set.

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
menuItemRef or both itemText and itemUniText are nullptr
APIERR_BADINDEX
the specified menu item does not belong to the caller add-on

For other common API errors see the API Errors document.

 

Remarks

This function is used to get the text of a menu item which belongs to the caller API tool add-on. The menu item is referenced with the resource ID and the string number.

To change the text of a menu item use the APIIo_SetMenuItemTextID function.

 

Example


void    ReportChosenCommand (short menuResID, short itemInd)

{
    API_MenuItemRef     itemRef;
    char                itemStr [256], message [256];

    BNZeroMemory (&itemRef, sizeof (API_MenuItemRef));
    itemRef.menuResID = menuResID;
    itemRef.itemIndex = itemInd;
    if (ACAPI_Interface (APIIo_GetMenuItemTextID, &itemRef, itemStr) == NoError) {
        sprintf (message, "You have chosen the %s command", itemStr);
        ACAPI_WriteReport (itemStr, true);
    }

    return;
}

 

Requirements

Version: API 2.1 or later
Header: APIdefs_Interface.h

 

See Also

API_MenuItemRef,
APIIo_SetMenuItemTextID,
ACAPI_Interface, API Functions