本文整理汇总了C++中InsertMenuItem函数的典型用法代码示例。如果您正苦于以下问题:C++ InsertMenuItem函数的具体用法?C++ InsertMenuItem怎么用?C++ InsertMenuItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InsertMenuItem函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sizeof
bool
MenuOperator::add_item(const Menu& submenu)
{
MENUITEMINFO menu_item_info;
menu_item_info.cbSize = sizeof(MENUITEMINFO);
menu_item_info.fMask = MIIM_SUBMENU | MIIM_TYPE;
menu_item_info.fType = MFT_STRING;
menu_item_info.hSubMenu = submenu.handle();
menu_item_info.dwTypeData = const_cast<char*>(submenu.label().c_str());
menu_item_info.cch = submenu.label().length();
InsertMenuItem(handle(), 0xffff, TRUE, &menu_item_info);
return true;
}
开发者ID:snori,项目名称:ntk,代码行数:17,代码来源:stdmenu.cpp
示例2: sysmenu_init_topmost
void sysmenu_init_topmost(HWND hWnd, HMENU hMenu)
{
MENUITEMINFO mii;
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_CHECKMARKS;
mii.fType = MFT_STRING;
mii.wID = IDM_TOPMOST;
mii.dwTypeData = (LPWSTR)L"TopMost (&T)";
mii.cch = (UINT) wcslen(mii.dwTypeData);
InsertMenuItem(hMenu, SC_CLOSE, FALSE, &mii);
changeStateTopMostMenu(hWnd,hMenu);
}
开发者ID:isseki,项目名称:metacryst,代码行数:17,代码来源:misc.cpp
示例3: menuhook
static void menuhook(const char* menustr, HMENU hMenu, int flag)
{
if (flag == 1)
{
// Delete all related project entries and regenerate
int iFirstPos;
hMenu = FindMenuItem(hMenu, g_projMgrCmdTable[g_iORPCmdIndex].accel.accel.cmd, &iFirstPos);
if (hMenu)
{
int iSlot = 0;
int iPos;
while (true)
{
int iCmd = GetLoadCommandID(iSlot, false);
if (iCmd)
{
if (FindMenuItem(hMenu, iCmd, &iPos))
DeleteMenu(hMenu, iPos, MF_BYPOSITION);
else
break;
}
else
break;
iSlot++;
}
if (!g_relatedProjects.Get()->GetSize())
{
MENUITEMINFO mi={sizeof(MENUITEMINFO),};
mi.fMask = MIIM_TYPE | MIIM_STATE | MIIM_ID;
mi.fType = MFT_STRING;
mi.fState = MFS_GRAYED;
mi.dwTypeData = (char *)__localizeFunc(g_projMgrCmdTable[g_iORPCmdIndex].menuText,"sws_menu",0);
mi.wID = g_projMgrCmdTable[g_iORPCmdIndex].accel.accel.cmd;
InsertMenuItem(hMenu, iFirstPos, true, &mi);
}
else
{
for (int i = 0; i < g_relatedProjects.Get()->GetSize(); i++)
AddToMenu(hMenu, g_relatedProjects.Get()->Get(i)->Get(), GetLoadCommandID(i, true), iFirstPos++, true, MFS_UNCHECKED);
}
}
}
}
开发者ID:Breeder,项目名称:sws,代码行数:46,代码来源:ProjectMgr.cpp
示例4: assert
void Explorerplusplus::AddMenuEntries(LPITEMIDLIST pidlParent,
const std::list<LPITEMIDLIST> &pidlItemList,DWORD_PTR dwData,HMENU hMenu)
{
assert(dwData != NULL);
FileContextMenuInfo_t *pfcmi = reinterpret_cast<FileContextMenuInfo_t *>(dwData);
bool AddNewTabMenuItem = false;
if(pfcmi->uFrom == FROM_LISTVIEW)
{
if(pidlItemList.size() == 1)
{
SFGAOF FileAttributes = SFGAO_FOLDER;
LPITEMIDLIST pidlComplete = ILCombine(pidlParent,pidlItemList.front());
GetItemAttributes(pidlComplete,&FileAttributes);
CoTaskMemFree(pidlComplete);
if(FileAttributes & SFGAO_FOLDER)
{
AddNewTabMenuItem = true;
}
}
}
else if(pfcmi->uFrom == FROM_TREEVIEW)
{
/* The treeview only contains folders,
so the new tab menu item will always
be shown. */
AddNewTabMenuItem = true;
}
if(AddNewTabMenuItem)
{
MENUITEMINFO mii;
TCHAR szTemp[64];
LoadString(m_hLanguageModule,IDS_GENERAL_OPEN_IN_NEW_TAB,szTemp,SIZEOF_ARRAY(szTemp));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_STRING|MIIM_ID;
mii.wID = MENU_OPEN_IN_NEW_TAB;
mii.dwTypeData = szTemp;
InsertMenuItem(hMenu,1,TRUE,&mii);
}
}
开发者ID:linquize,项目名称:explorerplus-custom,代码行数:46,代码来源:ShellContextMenuHandler.cpp
示例5: createpmenusettings
static HMENU createpmenusettings (void)
{
HMENU hmnu;
MENUITEMINFO mii;
memset (&mii, 0, sizeof(MENUITEMINFO));
mii.type = MFT_STRING;
mii.id = 0;
mii.typedata = (DWORD)SM_ST_SET;
hmnu = CreatePopupMenu (&mii);
mii.type = MFT_STRING ;
mii.state = 0;
mii.id = IDM_PREF;
mii.typedata = (DWORD)SM_ST_PREF;
InsertMenuItem(hmnu, 0, TRUE, &mii);
return hmnu;
}
开发者ID:Trietptm-on-Coding-Algorithms,项目名称:CodeLibrary,代码行数:18,代码来源:same.c
示例6: memset
void CGitExtensionsShellEx::AddMenuItem(HMENU hMenu, LPSTR text, int resource, int firstId, int id, UINT position)
{
MENUITEMINFO mii;
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_STRING | MIIM_ID;
if (resource)
{
mii.fMask |= MIIM_BITMAP;
mii.hbmpItem = IsVistaOrLater() ? IconToBitmapPARGB32(resource) : HBMMENU_CALLBACK;
myIDMap[id] = resource;
myIDMap[firstId + id] = resource;
}
mii.wID = firstId + id;
mii.dwTypeData = text;
InsertMenuItem(hMenu, position, TRUE, &mii);
}
开发者ID:jianhuiz,项目名称:gitextensions,代码行数:18,代码来源:GitExtensionsShellEx.cpp
示例7: MyInsertMenu
bool MyInsertMenu(HMENU hMenu, int pos, UINT id, const LPCTSTR szTitle, HBITMAP bm = NULL)
{
MENUITEMINFO MenuItem;
MenuItem.cbSize = sizeof(MenuItem);
if (szTitle)
MenuItem.fType = MFT_STRING;
else
MenuItem.fType = MFT_SEPARATOR;
MenuItem.fMask = MIIM_TYPE | MIIM_ID | MIIM_DATA;
if (bm)
MenuItem.fMask |= MIIM_CHECKMARKS;
MenuItem.wID = id;
MenuItem.hbmpChecked = bm;
MenuItem.hbmpUnchecked = bm;
MenuItem.dwTypeData = (LPWSTR)szTitle;
return InsertMenuItem(hMenu, pos, TRUE, &MenuItem) != 0;
}
开发者ID:vladios13,项目名称:image-uploader,代码行数:18,代码来源:FloatingWindow.cpp
示例8: CreatePopupMenu
void CMainWindow::CreateDebugMenu()
{
HMENU hMenu = CreatePopupMenu();
InsertMenu(hMenu, 0, MF_STRING, ID_MAIN_DEBUG_SHOWDEBUG, _T("Show Debugger"));
InsertMenu(hMenu, 1, MF_SEPARATOR, 0, nullptr);
InsertMenu(hMenu, 2, MF_STRING, ID_MAIN_DEBUG_DUMPFRAME, _T("Dump Next Frame\tF11"));
InsertMenu(hMenu, 3, MF_STRING, ID_MAIN_DEBUG_SHOWFRAMEDEBUG, _T("Show Frame Debugger"));
InsertMenu(hMenu, 4, MF_STRING | MF_CHECKED, ID_MAIN_DEBUG_ENABLEGSDRAW, _T("GS Draw Enabled"));
MENUITEMINFO ItemInfo;
memset(&ItemInfo, 0, sizeof(MENUITEMINFO));
ItemInfo.cbSize = sizeof(MENUITEMINFO);
ItemInfo.fMask = MIIM_STRING | MIIM_SUBMENU;
ItemInfo.dwTypeData = _T("Debug");
ItemInfo.hSubMenu = hMenu;
InsertMenuItem(GetMenu(m_hWnd), 3, TRUE, &ItemInfo);
}
开发者ID:dona12345,项目名称:Play-,代码行数:18,代码来源:MainWindow.cpp
示例9: sizeof
bool
CUpgradrToolbar::OnDisableDropdown(LPNMTOOLBAR data)
{
RECT rect;
m_kToolbar.SendMessage(TB_GETRECT, data->iItem, reinterpret_cast<LPARAM>(&rect));
m_kToolbar.MapWindowPoints(HWND_DESKTOP, reinterpret_cast<LPPOINT>(&rect), 2);
TPMPARAMS tpm;
tpm.cbSize = sizeof(tpm);
tpm.rcExclude = rect;
CMenu menu;
menu.LoadMenu(MAKEINTRESOURCE(IDR_DISABLEMENU));
if (menu.IsNull()) throw CUpgradrWindowsError(GetLastError());
ScriptManagerLock scriptManager;
MENUITEMINFO mii = { sizeof(MENUITEMINFO) };
UINT pos = 0;
UINT uID = 1000;
CMenuHandle popupMenu = menu.GetSubMenu(0);
if (popupMenu.IsNull()) throw CUpgradrWindowsError(GetLastError());
CScriptManager::iterator i = scriptManager->begin();
while (i!=scriptManager->end())
{
CScript* script = i->second;
memset(&mii, 0, sizeof(MENUITEMINFO));
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_STATE | MIIM_STRING | MIIM_ID | MIIM_DATA;
mii.wID = uID++;
mii.fState = MFS_CHECKED;
mii.dwItemData = i->first;
TCHAR buf[1024];
_tcscpy_s(buf, 1024, script->Name());
mii.dwTypeData = buf;
InsertMenuItem(popupMenu, pos++, TRUE, &mii);
++i;
}
TrackPopupMenuEx(popupMenu, TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL, rect.left, rect.bottom, m_kToolbar, &tpm);
return true;
}
开发者ID:cherry-wb,项目名称:upgradr,代码行数:44,代码来源:UpgradrToolbar.cpp
示例10: wxTreeItemId
void BundlePane::OnTreeEndDrag(wxTreeEvent& event) {
if (!m_draggedItem.IsOk()) return;
const wxTreeItemId itemSrc = m_draggedItem;
const wxTreeItemId itemDst = event.GetItem();
m_draggedItem = wxTreeItemId();
if (!itemDst.IsOk()) return; // Invalid destintion
if (itemSrc == itemDst) return; // Can't drag to self
if (IsTreeItemParentOf(itemSrc, itemDst)) return; // Can't drag to one of your own children
wxLogDebug(wxT("Ending Drag over item: %s"), m_bundleTree->GetItemText(itemDst).c_str());
const BundleItemData* srcData = (BundleItemData*)m_bundleTree->GetItemData(itemSrc);
const BundleItemData* dstData = (BundleItemData*)m_bundleTree->GetItemData(itemDst);
if (!dstData->IsMenuItem()) return; // You can only drag items to menu
if (dstData->m_bundleId != srcData->m_bundleId) return; // Items can only be dragged within same bundle
// We have to cache uuid of submenus
const wxString subUuid = (srcData->m_type == BUNDLE_SUBDIR) ? srcData->m_uuid : wxString(wxEmptyString);
const unsigned int bundleId = srcData->m_bundleId;
PListDict infoDict = GetEditableMenuPlist(bundleId);
// Insert the item
Freeze();
const wxString name = m_bundleTree->GetItemText(itemSrc);
const wxTreeItemId insertedItem = InsertMenuItem(itemDst, name, new BundleItemData(*srcData), infoDict);
if (srcData->m_type == BUNDLE_SUBDIR) {
CopySubItems(itemSrc, insertedItem);
}
// Delete source ref
if (srcData->IsMenuItem()) RemoveMenuItem(itemSrc, false, infoDict);
Thaw();
// Save the modified plist
m_plistHandler.SaveBundle(bundleId);
// Update menu in editorFrame
m_syntaxHandler.ReParseBundles(true/*onlyMenu*/);
}
开发者ID:khmerlovers,项目名称:e,代码行数:44,代码来源:BundlePane.cpp
示例11: InsertMenuItemWithSeparators
static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *lpmii)
{
TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)lpmii->dwItemData), *p;
if (pimi == NULL)
return;
// check for separator before
if (uItem) {
UINT fType = GetMenuItemTypeData(hMenu, uItem - 1, p);
if (p != NULL && fType != MFT_SEPARATOR) {
if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL)) {
// but might be supposed to be after the next one instead
if (!(uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) == MFT_SEPARATOR))
InsertSeparator(hMenu, uItem);
uItem++;
}
}
}
// check for separator after
if (uItem < GetMenuItemCount(hMenu)) {
UINT fType = GetMenuItemTypeData(hMenu, uItem, p);
if (p != NULL && fType != MFT_SEPARATOR)
if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL))
InsertSeparator(hMenu, uItem);
}
// create local copy *lpmii so we can change some flags
MENUITEMINFO mii = *lpmii;
int count = GetMenuItemCount(hMenu);
if (count != 0 && (count % 33) == 0 && pimi->mi.root != NULL) {
if (!(mii.fMask & MIIM_FTYPE))
mii.fType = 0;
mii.fMask |= MIIM_FTYPE;
mii.fType |= MFT_MENUBARBREAK;
}
if (!pimi->CustomName)
mii.dwTypeData = GetMenuItemText(pimi);
InsertMenuItem(hMenu, uItem, TRUE, &mii);
}
开发者ID:truefriend-cz,项目名称:miranda-ng,代码行数:43,代码来源:menu_utils.cpp
示例12: sizeof
bool LiferayNativityContextMenus::_InsertMenu(HMENU hMenu, int location, int command, const wchar_t* text, bool enabled)
{
MENUITEMINFO menuItem = { sizeof(menuItem) };
menuItem.fMask = MIIM_STRING | MIIM_ID | MIIM_STATE;
menuItem.dwTypeData = (LPWSTR)text;
menuItem.wID = command;
menuItem.fState = enabled ? MFS_ENABLED : MFS_GRAYED;
if (!InsertMenuItem(hMenu, location, TRUE, &menuItem))
{
return false;
}
return true;
}
开发者ID:iterate-ch,项目名称:liferay-nativity,代码行数:19,代码来源:LiferayNativityContextMenus.cpp
示例13: menuitem_add
BOOL menuitem_add(HMENU hmenu, TCHAR* lpstr, UINT index, UINT id)
{
MENUITEMINFO mi;
mi.cbSize = sizeof(MENUITEMINFO);
mi.fMask = MIIM_STATE | MIIM_TYPE | MIIM_ID;
if (lpstr)
{
mi.fType = MFT_STRING;
mi.dwTypeData = lpstr;
mi.cch = strlen(lpstr);
}
else
{
mi.fType = MFT_SEPARATOR;
}
mi.fState = MFS_ENABLED;
mi.wID = id;
return InsertMenuItem(hmenu, index, FALSE, &mi);
}
开发者ID:pezcode,项目名称:mapimp,代码行数:19,代码来源:mapimp.c
示例14: wcscpy_s
BOOL CIconMenu::AppendMenuIcon(UINT_PTR nIDNewItem, LPCTSTR lpszNewItem, UINT uIcon /* = 0 */)
{
TCHAR menutextbuffer[255] = {0};
wcscpy_s(menutextbuffer, lpszNewItem);
if ((uIcon == 0)||(!bShowIcons))
return CMenu::AppendMenu(MF_STRING | MF_ENABLED, nIDNewItem, menutextbuffer);
MENUITEMINFO info = {0};
info.cbSize = sizeof(info);
info.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_ID | MIIM_BITMAP;
info.fType = MFT_STRING;
info.wID = (UINT)nIDNewItem;
info.dwTypeData = menutextbuffer;
info.hbmpItem = bitmapUtils.IconToBitmapPARGB32(AfxGetResourceHandle(), uIcon);
icons[nIDNewItem] = uIcon;
return InsertMenuItem((UINT)nIDNewItem, &info);
}
开发者ID:ch3cooli,项目名称:TSVNUtils,代码行数:19,代码来源:IconMenu.cpp
示例15: CreatePopupMenu
void WinGui::Window::CreateMenu(){
menuID = CreatePopupMenu();
MENUITEMINFO mii;
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_STATE | MIIM_TYPE | MIIM_SUBMENU | MIIM_ID;
mii.fType = MFT_STRING;
mii.fState = MFS_ENABLED;
mii.dwTypeData = "Menu Item!";
mii.cch = strlen("Menu Item!");
mii.wID = PMENU;
mii.hSubMenu = NULL;
bool t = InsertMenuItem(menuID, 1, false, &mii);
int xy = GetMessagePos();
TrackPopupMenu(menuID,
TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_TOPALIGN,
LOWORD(xy), HIWORD(xy),
NULL, hWnd, NULL);
}
开发者ID:artemcpp,项目名称:winControls,代码行数:19,代码来源:Window.cpp
示例16: MAKE_HRESULT
STDMETHODIMP CGitExtensionsShellEx::QueryContextMenu (
HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd,
UINT uidLastCmd, UINT uFlags )
{
// If the flags include CMF_DEFAULTONLY then we shouldn't do anything.
if ( uFlags & CMF_DEFAULTONLY )
return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, 0 );
//InsertMenu (hmenu, uMenuIndex, MF_BYPOSITION, uidFirstCmd, _T("GitEx") );
int id = 0;
CString szCascadeContextMenu = GetRegistryValue(HKEY_CURRENT_USER, "SOFTWARE\\GitExtensions\\GitExtensions", "ShellCascadeContextMenu");
CascadeContextMenu = !(szCascadeContextMenu == "False");
if (CascadeContextMenu)
{
// show context menu cascaded in submenu
HMENU popupMenu = CreateMenu();
id = PopulateMenu(popupMenu, uidFirstCmd + id, true);
//InsertMenu(hmenu, uMenuIndex++, MF_STRING | MF_BYPOSITION | MF_POPUP, (int)popupMenu, "Git Extensions");
MENUITEMINFO info;
info.cbSize = sizeof( MENUITEMINFO );
info.fMask = MIIM_ID | MIIM_TYPE | MIIM_SUBMENU;
info.fType = MFT_STRING;
info.wID = uidFirstCmd + 1;
info.dwTypeData = _T("Git Extensions");
info.hSubMenu = popupMenu;
InsertMenuItem(hmenu, 0, true, &info);
}
else
{
// show menu items directly
id = PopulateMenu(hmenu, uidFirstCmd + id, false);
}
return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, id-uidFirstCmd );
}
开发者ID:robin521111,项目名称:gitextensions,代码行数:42,代码来源:GitExtensionsShellEx.cpp
示例17: CreatePopupMenu
bool VirtualDimension::CreateLangMenu()
{
LocalesIterator it;
int count = 0;
// languageCode from registry
int currentLanguageCode = Locale::GetInstance().GetLanguage();
//Create the menu
m_pLangMenu = CreatePopupMenu();
//Add the entries
while(m_pLangMenu && it.GetNext())
{
String name;
HICON hicon;
name = it.GetLanguage(&hicon, NULL);
if (!name.empty())
{
MENUITEMINFO iteminfo;
int code = it.GetLanguageCode();
count++;
iteminfo.cbSize = sizeof(MENUITEMINFO);
iteminfo.fMask = MIIM_DATA|MIIM_STRING|MIIM_FTYPE|MIIM_BITMAP|MIIM_ID;
iteminfo.dwTypeData = (LPTSTR)name.c_str();
iteminfo.fType = MFT_STRING;
iteminfo.dwItemData = (ULONG_PTR)hicon;
iteminfo.hbmpItem = HBMMENU_CALLBACK;
iteminfo.wID = WM_VD_LANGUAGE+code; // in order to get WM_COMMAND msg
InsertMenuItem(m_pLangMenu, WM_VD_LANGUAGE+code, FALSE, &iteminfo);
if (code == currentLanguageCode)
CheckMenuItem(m_pLangMenu,(UINT)code+WM_VD_LANGUAGE,MF_BYCOMMAND|MF_CHECKED);
// then we connect any menu to the window proc
SetCommandHandler(WM_VD_LANGUAGE+code, this, &VirtualDimension::OnCmdLanguageChange);
SetSysCommandHandler(WM_VD_LANGUAGE+code, this, &VirtualDimension::OnCmdLanguageChange);
}
}
return count > 1;
}
开发者ID:HaijinW,项目名称:VirtualDimension,代码行数:42,代码来源:VirtualDimension.cpp
示例18: GetMenuItemCount
/*static*/
void MenuWin::InsertItemIntoNativeMenu(
MenuItemWin* item, HMENU nativeMenu, bool registerNative, int position)
{
// A -1 value means to stick the new item at the end
if (position == -1) {
position = GetMenuItemCount(nativeMenu);
if (position == 0) position = 1;
}
MENUITEMINFO itemInfo;
item->CreateNative(&itemInfo, nativeMenu, registerNative);
BOOL success = InsertMenuItem(nativeMenu, position, TRUE, &itemInfo);
if (!success) {
string error = Win32Utils::QuickFormatMessage(GetLastError());
throw ValueException::FromString("Could not insert native item: " + error);
}
}
开发者ID:Defachko,项目名称:titanium_desktop,代码行数:21,代码来源:MenuWin.cpp
示例19: ShowContextMenu
void ShowContextMenu(HWND hWnd)
{
MENUITEMINFO separatorBtn = {0};
separatorBtn.cbSize = sizeof(MENUITEMINFO);
separatorBtn.fMask = MIIM_FTYPE;
separatorBtn.fType = MFT_SEPARATOR;
HMENU hMenu = CreatePopupMenu();
if(hMenu != NULL)
{
InsertMenu(hMenu, -1, MF_BYPOSITION, ID_FILE_OPTIONS, GString(IDS_MENU_OPTIONS).c_str());
InsertMenuItem(hMenu, -1, FALSE, &separatorBtn);
InsertMenu(hMenu, -1, MF_BYPOSITION, IDM_EXIT, GString(IDS_MENU_EXIT).c_str());
POINT pt;
GetCursorPos(&pt);
SetForegroundWindow(hWnd);
TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hWnd, NULL);
DestroyMenu(hMenu);
PostMessage(hWnd, WM_NULL, 0, 0);
}
}
开发者ID:MOURAD24,项目名称:SearchClip,代码行数:20,代码来源:LaunchBrowser.cpp
示例20: OMenuItem
void OMenu::InsertSeparator(UINT uItem, BOOL byPosition, const tstring& caption, bool accels /*= false*/) {
OMenuItem* mi = new OMenuItem();
mi->text = caption;
tstring::size_type i = 0;
if (!accels)
while ((i = mi->text.find('&')) != tstring::npos)
mi->text.erase(i, i+1);
if(mi->text.length() > 25) {
// mi->text = mi->text.substr(0, 25) + _T("..."); // !SMT!-UI
}
mi->parent = this;
items.push_back(mi);
MENUITEMINFO mii = {0};
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_FTYPE | MIIM_DATA;
mii.fType = MFT_OWNERDRAW | MFT_SEPARATOR;
mii.dwItemData = (ULONG_PTR)mi;
InsertMenuItem(uItem, byPosition, &mii);
}
开发者ID:inetra,项目名称:peers1,代码行数:20,代码来源:OMenu.cpp
注:本文中的InsertMenuItem函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论