JavaScript Editor js editor     Web development 

Main Page

Copies the text of a menu bar or menu title to the buffer pointed to by text.

void _GetItemText(MENUID menuid, ITEMID itemid, char FAR *text)
MENUID menuid;            /* Menu identifier. */
ITEMID itemid;            /* Menu item identifier. */
char FAR *text;            /* Buffer address for text. */


The buffer must be at least 80 bytes long.

For more information on how to create an API library and integrate it with Visual FoxPro, see Accessing the Visual FoxPro API.


The following example creates a menu with three items and then retrieves the text of each item with _GetItemText(В ).

Visual FoxPro Code

В Copy Code

C Code

В Copy Code
#include <pro_ext.h>

FAR GetItemTextEx(ParamBlk FAR *parm)
   MENUID menuId;
   ITEMID itemId;
   Point loc;
   char FAR *itemText;

   menuId = _GetNewMenuId();
   _NewMenu(MPOPUP, menuId);

   itemId = _GetNewItemId(menuId);
   _NewItem(menuId, itemId, -2, "\\<1st item");

   itemId = _GetNewItemId(menuId);
   _NewItem(menuId, itemId, -2, "\\<2nd item");

   itemId = _GetNewItemId(menuId);
   _NewItem(menuId, itemId, -2, "\\<3rd item");

   loc.v = 10; loc.h = 20;
   _SetMenuPoint(menuId, loc);


   if ((itemText = _Alloca(80)) == 0)
      _Error(182); // "Insufficient memory"
   _GetItemText(menuId, _GetItemId(menuId, 0), itemText);
   _PutStr("\nItem text of 1st item = "); _PutStr(itemText);

   _GetItemText(menuId, _GetItemId(menuId, 1), itemText);
   _PutStr("\nItem text of 2nd item = "); _PutStr(itemText);

   _GetItemText(menuId, _GetItemId(menuId, 2), itemText);
   _PutStr("\nItem text of 3rd item = "); _PutStr(itemText);

   _Execute("WAIT WINDOW");

FoxInfo myFoxInfo[] = {
   {"ONLOAD", (FPFI) GetItemTextEx, CALLONLOAD, ""},
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

See Also

JavaScript Editor js editor     Web development