void JXTextMenuData::SetMenuItems ( const JCharacter* menuStr, const JCharacter* idNamespace ) { DeleteAll(); InsertMenuItems(1, menuStr, idNamespace); }
STDMETHODIMP CLocateShellExtension::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) { #ifdef _LOGGING char szTemp[100]; sprintf_s(szTemp, 100,"CShellExt::QueryContextMenu(), uFlags==>%d", uFlags); ODS(szTemp); #endif if (uFlags & CMF_DEFAULTONLY) { ODS("CMF_DEFAULTONLY..."); return NOERROR; } HMODULE hLanDll=GetLanguageResource(); if (hLanDll==NULL) return NOERROR; DWORD dwSettings=ReadSettingsFromRegistry(); if (dwSettings&fSubMenu) { HMENU hSubMenu=CreatePopupMenu(); UINT uHighestId=0; if (InsertMenuItems(hSubMenu,0,idCmdFirst,uHighestId)) { MENUITEMINFO mii; char szTitle[200]; LoadString(hLanDll,IDS_EXTLOCATEMENU,szTitle,200); mii.cbSize=sizeof(MENUITEMINFO); mii.fMask=MIIM_SUBMENU|MIIM_TYPE; mii.fType=MFT_STRING; mii.dwTypeData=szTitle; mii.hSubMenu=hSubMenu; InsertMenuItem(hMenu,indexMenu,TRUE,&mii); FreeLibrary(hLanDll); return ResultFromShort(uHighestId+1-idCmdFirst); } DestroyMenu(hSubMenu); FreeLibrary(hLanDll); return NOERROR; } else { UINT uHighestId=0; if (InsertMenuItems(hMenu,indexMenu,idCmdFirst,uHighestId)) { FreeLibrary(hLanDll); return ResultFromShort(uHighestId+1-idCmdFirst); } FreeLibrary(hLanDll); return NOERROR; } }