Given a selection type, this command depending upon the supplied screen co-ordinates, will Supply a the resource ID and popup position of the most suitable popup menu
int GetMenuID( int nSeletionType, int xCur, int yCur, int & npos )
The resource ID
EX1
#include <Control.h> #include <OC_Res.h> void OriginObject_GetMenuID_Ex1(Menu* pmenu) { Worksheet wks = Project.ActiveLayer(); int c1, c2, r1, r2; int nPos = 0; int nSel = wks.GetSelection(c1, c2, r1, r2); HINSTANCE hInstOutil = GetModuleHandle(MODULE_OU); int nId = wks.GetMenuID(nSel, 0, 0, nPos); if(pmenu->Load(hInstOutil, nId, nPos)) { HWND hMenu = pmenu->GetSafeHmenu(); if(hMenu) wks.AddInternalMenu(hMenu, nId, 1); int nCmd = pmenu->TrackPopupResMenu(0, 0, 0, GetWindow()); //Screen co-ordinates wks.GetPage().ProcessCommand(nCmd); } }
origin.h