JavaScript Editor js editor     Web development 

Main Page

Creates a new menu of the specified menu type.

int _NewMenu(int mtype, MENUID menuid)
int mtype;                  /* Menu type. */
MENUID menuid;            /* Menu identifier. */


You can specify MPOPUP or MBAR as the mtype parameter. The menu identifier must be unique.

Use _GetNewMenuId(В ) to obtain an available menu id. _NewMenu(В ) returns 0 if it succeeds in creating a new menu. If it's unsuccessful, _NewMenu(В ) returns a negative integer whose absolute value is a Visual FoxPro error number.

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 uses _NewMenu(В ) to create a menu.

Visual FoxPro Code

В Copy Code

C Code

В Copy Code
#include <pro_ext.h>

void putLong(long n)
   Value val;

   val.ev_type = 'I';
   val.ev_long = n;
   val.ev_width = 10;


FAR GetNewItemId(ParamBlk FAR *parm)
   MENUID menuId;
   ITEMID itemId;
   Point loc;

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

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

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

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

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

   _MenuInteract(&menuId, &itemId);

   _PutStr("\nmenuId ="); putLong(menuId);
   _PutStr("\nitemId ="); putLong(itemId);


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

See Also

JavaScript Editor js editor     Web development