这篇教程C++ GetMenuItemID函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetMenuItemID函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMenuItemID函数的具体用法?C++ GetMenuItemID怎么用?C++ GetMenuItemID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetMenuItemID函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: playermenu_find_unique_idWORD playermenu_find_unique_id( ){ WORD id = 1024; // Client menu IDs are well below this number. for (vector<MODULE*>::const_iterator i = g_modules.begin( ); i != g_modules.end( ); ++i) { const int count = GetMenuItemCount( (*i)->menu ); for (int j = 0; j < count; ++j) { if ((WORD) GetMenuItemID( (*i)->menu, j ) == id) id = (WORD) GetMenuItemID( (*i)->menu, j ) + 1; } } return id;}
开发者ID:Gerolkae,项目名称:Furnarchy,代码行数:14,
示例2: switch////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 弹出菜单初始化VOID CMainWnd::OnMenuPopup(WPARAM wParam, LPARAM lParam){ HWND hWnd; DWORD dwSize; TCHAR tzTemp[512]; TCHAR tzPath[512]; switch (GetMenuItemID((HMENU) wParam, 0)) { case IDM_Help_Desktop: // 判断快捷方式是否存在 CheckCommand(IDM_Help_Desktop, CShortcut::Exist(CSIDL_DESKTOP)); CheckCommand(IDM_Help_StartMenu, CShortcut::Exist(CSIDL_STARTMENU)); CheckCommand(IDM_Help_ProgramMenu, CShortcut::Exist(CSIDL_PROGRAMS)); CheckCommand(IDM_Help_QuickLaunch, CShortcut::Exist(CSIDL_APPDATA)); CheckCommand(IDM_Help_VisualStudio, CVSTool::Exist()); break; case IDM_Play_Play: hWnd = CClientWnd::GetActive(); _ExIf(hWnd, SendMessage(hWnd, WM_INITMENUPOPUP, wParam, lParam)); break; case IDM_View_Toolbar: GetModuleFileName(NULL, tzTemp, MAX_PATH); wsprintf(tzPath, TEXT("/"%s/" /"%%1/""), tzTemp); dwSize = _NumOf(tzTemp); SHGetValue(HKEY_CLASSES_ROOT, STR_AppName TEXT("//shell//open//command"), NULL, NULL, tzTemp, &dwSize); CheckCommand(IDM_View_AssociateFile, lstrcmpi(tzTemp, tzPath) == 0); break; }}
开发者ID:Yonsm,项目名称:RawPlayer,代码行数:34,
示例3: CheckForMessage/* * CheckForMessage - check for a WM_COMMAND message that needs to be * sent to the maximized window */static bool CheckForMessage( HMENU menu, HWND currentWindow, WPI_PARAM1 wparam, WPI_PARAM2 lparam ){ int num; int i; UINT id; UINT flags; if( menu != NULL ) { num = (int)_wpi_getmenuitemcount( menu ); for( i = 0; i < num; i++ ) { flags = GetMenuState( menu, i, MF_BYPOSITION ); if( flags & MF_POPUP ) { if( CheckForMessage( GetSubMenu( menu, i ), currentWindow, wparam, lparam ) ) { return( TRUE ); } } else { id = GetMenuItemID( menu, i ); if( id == wparam ) { _wpi_sendmessage( currentWindow, WM_COMMAND, wparam, lparam ); return( TRUE ); } } } } return( FALSE );} /* CheckForMessage */
开发者ID:hubei,项目名称:open-watcom,代码行数:33,
示例4: GetMenuItemCountvoid menu_helpers::win32_auto_mnemonics(HMENU menu){ mnemonic_manager mgr; unsigned n, m = GetMenuItemCount(menu); pfc::string8_fastalloc temp,temp2; for(n=0;n<m;n++)//first pass, check existing mnemonics { unsigned type = uGetMenuItemType(menu,n); if (type==MFT_STRING) { uGetMenuString(menu,n,temp,MF_BYPOSITION); mgr.check_string(temp); } } for(n=0;n<m;n++) { HMENU submenu = GetSubMenu(menu,n); if (submenu) win32_auto_mnemonics(submenu); { unsigned type = uGetMenuItemType(menu,n); if (type==MFT_STRING) { unsigned state = submenu ? 0 : GetMenuState(menu,n,MF_BYPOSITION); unsigned id = GetMenuItemID(menu,n); uGetMenuString(menu,n,temp,MF_BYPOSITION); if (mgr.process_string(temp,temp2)) { uModifyMenu(menu,n,MF_BYPOSITION|MF_STRING|state,id,temp2); } } } }}
开发者ID:AICIDNN,项目名称:lastfm-desktop,代码行数:35,
示例5: GetSubMenu/////////////////////////////////////////////////////////////////////////////////// Event Handle//LRESULT CTrayIcon::OnTrayNotification( WPARAM wID, LPARAM lEvent ){ if ( wID!=m_nid.uID || ( lEvent!=WM_RBUTTONUP && lEvent!=WM_LBUTTONDBLCLK ) ) return 0; HMENU pSubMenu = GetSubMenu( m_hMenu , 0 ); ASSERT( pSubMenu ); if ( !pSubMenu ) return 0; if( m_nDefMenuItem == 0 ) { m_nDefMenuItem = GetMenuItemID( m_hMenu, 0 ); } if ( lEvent==WM_RBUTTONUP ) { // Make 'm_nDefMenuItem' menu item the default (bold font) ASSERT( SetMenuDefaultItem( pSubMenu, m_nDefMenuItem, FALSE ) != 0 ); POINT mouse; GetCursorPos( &mouse ); SetForegroundWindow( m_nid.hWnd ); TrackPopupMenu( pSubMenu, 0, mouse.x, mouse.y, 0, m_nid.hWnd, NULL ); } else // execute default menu item SendMessage( m_nid.hWnd, WM_COMMAND, m_nDefMenuItem, 0 ); return 1; // handled}
开发者ID:jsg2021,项目名称:Simply-Transparent,代码行数:37,
示例6: GetMenuItemIDvoid CFrameWnd::OnShowMenuPopupHint(HMENU hMenu){ // Get ID of first item in menu. int iFirstID = GetMenuItemID(hMenu, 0); // Is a first item? if (iFirstID != -1) { CString strHint; // Get application object. CTask* pApp = CTask::This(); ASSERT(pApp); // Calculate menu hint and load. // The hint is always a multiple of 100. int iHintID = iFirstID - (iFirstID % 10); strHint.LoadRsc(iHintID); // Show hint. if (m_pStatusBar) m_pStatusBar->HintBar()->Hint(strHint); } else { // Show dummy hint. if (m_pStatusBar) m_pStatusBar->HintBar()->Hint(""); }}
开发者ID:chrisoldwood,项目名称:WIN16,代码行数:31,
示例7: LuaGuiGetMenuItemId static uint32_t LuaGuiGetMenuItemId(void *hMenu, uint32_t position) { return GetMenuItemID( reinterpret_cast<HMENU>(hMenu), position ); }
开发者ID:myeang1,项目名称:YDWE,代码行数:7,
示例8: CompositeCMenu_HandleMenuMsgstatic HRESULT WINAPI CompositeCMenu_HandleMenuMsg(IContextMenu3 *iface, UINT uMsg, WPARAM wParam, LPARAM lParam){ CompositeCMenu *This = impl_from_IContextMenu3(iface); HMENU menu; UINT id; UINT index; IContextMenu2 *handler; HRESULT hres; TRACE("(%p)->(%x,%lx,%lx)/n",iface,uMsg,wParam,lParam); switch(uMsg) { case WM_INITMENUPOPUP: menu = (HMENU)wParam; id = GetMenuItemID(menu,LOWORD(lParam)); break; case WM_DRAWITEM: id = ((DRAWITEMSTRUCT*)lParam)->itemID; break; case WM_MEASUREITEM: id = ((MEASUREITEMSTRUCT*)lParam)->itemID; break; default: WARN("Unimplemented uMsg: 0x%x/n",uMsg); return E_NOTIMPL; } index = CompositeCMenu_GetIndexForCommandId(This,id); hres = IContextMenu_QueryInterface(This->menus[index],&IID_IContextMenu2, (void**)&handler); if(SUCCEEDED(hres)) return IContextMenu2_HandleMenuMsg(handler,uMsg,wParam,lParam); return S_OK;}
开发者ID:AlexSteel,项目名称:wine,代码行数:32,
示例9: menucpyvoid menucpy(HMENU hTargetMenu, HMENU hSourceMenu){ int n, id, nMn; TCHAR * strBuf; HMENU hSubMenu; nMn = GetMenuItemCount(hSourceMenu); strBuf = (TCHAR *)LocalAlloc(LPTR, 80); for (n=0; n<nMn; n++) { if (0 == (id = GetMenuItemID(hSourceMenu, n))) AppendMenu(hTargetMenu, MF_SEPARATOR, 0, 0L); else { GetMenuString(hSourceMenu, n, strBuf, 80, MF_BYPOSITION); if (id != -1) AppendMenu(hTargetMenu, GetMenuState(hSourceMenu, n, MF_BYPOSITION), id, strBuf); else { hSubMenu = CreatePopupMenu(); AppendMenu(hTargetMenu, MF_POPUP | MF_STRING, (uint)hSubMenu, strBuf); menucpy(hSubMenu, GetSubMenu(hSourceMenu, n)); } } } LocalFree((HLOCAL)strBuf);}
开发者ID:clickteam-plugin,项目名称:WaveOut,代码行数:27,
示例10: ASSERTHMENU CMDIFrameWnd::GetWindowMenuPopup(HMENU hMenuBar) // find which popup is the "Window" menu{ if (hMenuBar == NULL) return NULL; ASSERT(::IsMenu(hMenuBar)); int iItem = ::GetMenuItemCount(hMenuBar); while (iItem--) { HMENU hMenuPop = ::GetSubMenu(hMenuBar, iItem); if (hMenuPop != NULL) { int iItemMax = ::GetMenuItemCount(hMenuPop); for (int iItemPop = 0; iItemPop < iItemMax; iItemPop++) { UINT nID = GetMenuItemID(hMenuPop, iItemPop); if (nID >= AFX_IDM_WINDOW_FIRST && nID <= AFX_IDM_WINDOW_LAST) return hMenuPop; } } } // no default menu found TRACE(traceAppMsg, 0, "Warning: GetWindowMenuPopup failed!/n"); return NULL;}
开发者ID:AeonAxan,项目名称:mpc-hc,代码行数:28,
示例11: BiasMenuVOID NEAR PASCAL BiasMenu(HMENU hMenu, INT Bias){ INT pos, id, count; HMENU hSubMenu; CHAR szMenuString[80]; ENTER("BiasMenu"); count = GetMenuItemCount(hMenu); if (count < 0) return; for (pos = 0; pos < count; pos++) { id = GetMenuItemID(hMenu, pos); if (id < 0) { // must be a popup, recurse and update all ID's here if (hSubMenu = GetSubMenu(hMenu, pos)) BiasMenu(hSubMenu, Bias); } else if (id) { // replace the item that was there with a new // one with the id adjusted GetMenuString(hMenu, (WORD)pos, szMenuString, sizeof(szMenuString), MF_BYPOSITION); DeleteMenu(hMenu, pos, MF_BYPOSITION); InsertMenu(hMenu, (WORD)pos, MF_BYPOSITION | MF_STRING, id + Bias, szMenuString); } } LEAVE("BiasMenu");}
开发者ID:mingpen,项目名称:OpenNT,代码行数:32,
示例12: CreateMenuHMENU fsODMenu::CopyMenu(HMENU hMenu){ HMENU hCopy = CreateMenu (); for (int i = 0; i < GetMenuItemCount (hMenu); i++) { UINT uState = GetMenuState (hMenu, i, MF_BYPOSITION); UINT nID; char szMenuText [100]; if (uState & MF_POPUP) { nID = (UINT) CopyMenu (GetSubMenu (hMenu, i)); uState = MF_POPUP | MF_STRING; } else nID = GetMenuItemID (hMenu, i); GetMenuString (hMenu, i, szMenuText, sizeof (szMenuText), MF_BYPOSITION); AppendMenu (hCopy, uState, nID, szMenuText); } return hCopy;}
开发者ID:HackLinux,项目名称:Free-Download-Manager-vs2010,代码行数:26,
示例13: ATLASSERT// 增加窗口弹出的代码开始///////////////////////////////////////////////////////////////////////////////////////////////////////LRESULT CFloatingWnd::OnInitMenuPopup(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL& bHandled){ int nPos; UINT uId; // Call CCoolContextMenu's implementation CCoolContextMenu<CFloatingWnd>::OnInitMenuPopup(uMsg, wParam, lParam, bHandled); // Set the cursor shape to an arrow m_hCursor = ::LoadCursor(NULL, IDC_ARROW); ATLASSERT(m_hCursor); ::SetCursor(m_hCursor); CMenuHandle menuPopup = (HMENU)wParam; ATLASSERT(menuPopup.m_hMenu != NULL); for (nPos = 0; nPos < menuPopup.GetMenuItemCount(); nPos++) { uId = GetMenuItemID(menuPopup, nPos); switch (uId) { case ID_EDIT_SELECT_ALL: EnableMenuItem(menuPopup, uId, (GetWindowTextLength() > 0) ? MF_BYCOMMAND | MF_ENABLED : MF_BYCOMMAND | MF_GRAYED); break; case ID_EDIT_CUT: case ID_EDIT_COPY: case ID_EDIT_PASTE: EnableMenuItem(menuPopup, uId, IsClipboardFormatAvailable(CF_TEXT) ? MF_BYCOMMAND | MF_ENABLED : MF_BYCOMMAND | MF_GRAYED); break; default: break; } } return 0;}
开发者ID:henrywoo,项目名称:ultraie,代码行数:33,
示例14: UINTBOOL CRecBinViewer::ExecCommand (LPCONTEXTMENU pCtxMenu, LPCTSTR lpszCommand){ UINT uiID = UINT (-1); UINT uiCommand = 0; UINT uiMenuFirst = 1; UINT uiMenuLast = 0x00007FFF; HMENU hmenuCtx; int iMenuPos = 0; int iMenuMax = 0; TCHAR szMenuItem[MAX_PATH]; TCHAR verb[MAX_PATH] ; hmenuCtx = CreatePopupMenu(); HRESULT hr = pCtxMenu->QueryContextMenu(hmenuCtx, 0, uiMenuFirst, uiMenuLast, CMF_NORMAL); iMenuMax = GetMenuItemCount(hmenuCtx); for (iMenuPos = 0 ; iMenuPos < iMenuMax; iMenuPos++) { GetMenuString(hmenuCtx, iMenuPos, szMenuItem, MAX_PATH, MF_BYPOSITION) ; uiID = GetMenuItemID(hmenuCtx, iMenuPos) ; if ((uiID == -1) || (uiID == 0)) { } else { hr = pCtxMenu->GetCommandString(uiID - 1, GCS_VERB, NULL, (LPSTR)verb, MAX_PATH); if (FAILED (hr)) { verb[0] = TCHAR ('/0') ; } else { if (0 == _tcsicmp (verb, lpszCommand)) uiCommand = uiID - 1; } } } if ((UINT)-1 != uiCommand) { CMINVOKECOMMANDINFO cmi; ZeroMemory(&cmi, sizeof(CMINVOKECOMMANDINFO)); cmi.cbSize = sizeof(CMINVOKECOMMANDINFO); cmi.fMask = CMIC_MASK_FLAG_NO_UI; cmi.hwnd = m_hWnd; cmi.lpVerb = (LPSTR)MAKEINTRESOURCE (uiCommand); cmi.nShow = SW_SHOWNORMAL; hr = pCtxMenu->InvokeCommand(&cmi); if (SUCCEEDED (hr)) return TRUE; } return false;}
开发者ID:avrionov,项目名称:explorerxp,代码行数:58,
示例15: InitMenuPopupstatic void InitMenuPopup(HMENU hMenu, LPARAM index){ if ((GetMenuItemID(hMenu, 0) == CMD_DELETE) || (GetMenuItemID(hMenu, 1) == CMD_SAVE_AS)) { if (CountClipboardFormats() == 0) { EnableMenuItem(hMenu, CMD_DELETE, MF_GRAYED); EnableMenuItem(hMenu, CMD_SAVE_AS, MF_GRAYED); } else { EnableMenuItem(hMenu, CMD_DELETE, MF_ENABLED); EnableMenuItem(hMenu, CMD_SAVE_AS, MF_ENABLED); } } DrawMenuBar(Globals.hMainWnd);}
开发者ID:JaredSmudde,项目名称:reactos,代码行数:18,
示例16: set_visiblestatic void set_visible(int i) { visible=i; /* setup global variable */ CheckMenuItem(hpopup, GetMenuItemID(hpopup, 1), visible?MF_CHECKED:MF_UNCHECKED); /* check or uncheck menu item */ if(visible) { ShowWindow(hwnd, SW_SHOWNORMAL); /* show window */ SetForegroundWindow(hwnd); /* bring on top */ } else ShowWindow(hwnd, SW_HIDE); /* hide window */}
开发者ID:copilot-com,项目名称:CopilotVNC,代码行数:11,
示例17: hugsprim_GetMenuItemID_14static void hugsprim_GetMenuItemID_14(HugsStackPtr hugs_root){ HsPtr arg1; HsWord32 arg2; HsWord32 res1; arg1 = hugs->getPtr(); arg2 = hugs->getWord32(); res1 = GetMenuItemID(arg1, arg2); hugs->putWord32(res1); hugs->returnIO(hugs_root,1);}
开发者ID:xpika,项目名称:winhugs,代码行数:11,
示例18: GetIndexOfItemINT GetIndexOfItem(HMENU menu, UINT id){ for (int i = GetMenuItemCount(menu) - 1; i >= 0; i--) { int x = GetMenuItemID(menu, i); if (id == x) { return i; } } return -1;}
开发者ID:Eun,项目名称:MoveToDesktop,代码行数:12,
示例19: whileunsigned int Win32Popup::findInsertionPoint( unsigned int pos ) const{ // For this simple algorithm, we rely on the fact that in the final state // of the menu, the ID of each item is equal to its position in the menu int i = 0; while( i < GetMenuItemCount( m_hMenu ) && GetMenuItemID( m_hMenu, i ) < pos ) { i++; } return i;}
开发者ID:mstorsjo,项目名称:vlc,代码行数:12,
示例20: UpdMenuBOOL CALLBACKUpdMenu(HWND hwnd,LPARAM lParam){ int i; BOOL flag=lParam; // int Checked; HMENU hSysMenu=GetSystemMenu(hwnd, FALSE); for(i=0;i<GetMenuItemCount(hSysMenu) && hSysMenu;i++) if(GetMenuItemID(hSysMenu,i)==IDM_TRAY) hSysMenu = 0; if (hSysMenu && lParam) { InsertMenu (hSysMenu, GetMenuItemID(hSysMenu,0),MF_SEPARATOR,IDM_SEPARATOR, NULL) ; if(GetWindowLong(hwnd,GWL_EXSTYLE)&WS_EX_TOPMOST) InsertMenu (hSysMenu, GetMenuItemID(hSysMenu,0),MF_STRING|MF_CHECKED,IDM_ONTOP,"Always on top"); else InsertMenu (hSysMenu, GetMenuItemID(hSysMenu,0),MF_STRING,IDM_ONTOP,"Always on top"); InsertMenu (hSysMenu, GetMenuItemID(hSysMenu,0),MF_STRING,IDM_TRAY,"Minimize in tray"); InsertMenu (hSysMenu, GetMenuItemID(hSysMenu,0),MF_STRING,IDM_SIZE,"My size"); } if (hSysMenu && lParam==FALSE) { DeleteMenu (hSysMenu,IDM_TRAY,MF_BYCOMMAND); DeleteMenu (hSysMenu,IDM_ONTOP,MF_BYCOMMAND); DeleteMenu (hSysMenu,IDM_SEPARATOR,MF_BYCOMMAND); DeleteMenu (hSysMenu,IDM_SIZE,MF_BYCOMMAND); } return TRUE;}
开发者ID:shelt,项目名称:RBXTray,代码行数:29,
示例21: GetMenuItemCount /*static*/ int Win32MenuItem::GetNativeMenuItemPosition(NativeItemBits* bits) { int count = GetMenuItemCount(bits->parentMenu); for (int i = 0; i < count; i++) { if ((bits->submenu && GetSubMenu(bits->parentMenu, i) == bits->submenu) || (bits->id == GetMenuItemID(bits->parentMenu, i))) return i; } throw ValueException::FromString("Could not find native item index in native menu."); }
开发者ID:JamesHayton,项目名称:titanium_desktop,代码行数:14,
示例22: IsStartMenu/*-------------------------------------------------- HMENU is start menu ?----------------------------------------------------*/BOOL IsStartMenu(HMENU hmenu){ int i, count, id; count = GetMenuItemCount(hmenu); for(i = 0; i < count; i++) { id = GetMenuItemID(hmenu, i); // "Help" item if(id == 503) return TRUE; } return FALSE;}
开发者ID:k-takata,项目名称:TClockLight,代码行数:16,
示例23: InitMenuvoid InitMenu(HMENU menu,CString KeyName) { if ( menu==NULL || ( !::IsMenu(menu))) return ; CString tempname(_T("")); tempname=KeyName; CString szText; int nCount,subCount, id; nCount =GetMenuItemCount(menu);// menu->GetMenuItemCount(); //获取该层菜单数 for(int i=0;i<nCount;i++) //遍历所有菜单项 { //查看子菜单 如果有子菜单,返回0,否则返回子菜单项数目,如果是子菜单项,返回资源中的菜单COMMAND ID KeyName=_T(""); KeyName=tempname; id= GetMenuItemID(menu,i); if (id!=-1) { szText.Format(_T("_%d"),id); KeyName+=szText; //ModifyMenu(menu, i, MF_BYPOSITION|MF_STRING, id, gLoadString(KeyName)); } else { szText.Format(_T("_%d"),i); KeyName+=szText; // ModifyMenu(menu, i, MF_BYPOSITION|MF_STRING, i, gLoadString(KeyName)); } CString name=gLoadString(KeyName); if (name.CompareNoCase(_T("Not found"))!=0) { ModifyMenu(menu, i, MF_BYPOSITION|MF_STRING, id, name); } //ModifyMenu(menu, i, MF_BYPOSITION|MF_STRING, i, gLoadString(KeyName)); if( id==-1 ) { subCount =GetMenuItemCount(GetSubMenu(menu,i)); if ( subCount>0 ) InitMenu(GetSubMenu(menu,i),KeyName); } } }
开发者ID:jay-github,项目名称:T3000_Building_Automation_System,代码行数:51,
示例24: updateSoundOptionvoid updateSoundOption(){ MENUITEMINFO checkInfo = {}; checkInfo.cbSize = sizeof(MENUITEMINFO); checkInfo.fMask = MIIM_STATE; HMENU soundOptions = GetSubMenu(popupMenu, 0); UINT count = GetMenuItemCount(soundOptions); for (UINT i = 0; i < count; i++) { if (GetMenuItemID(soundOptions, i) == soundOption) { checkInfo.fState = MFS_CHECKED; SetMenuItemInfo(popupMenu, GetMenuItemID(soundOptions, i), 0, &checkInfo); } else { checkInfo.fState = MFS_UNCHECKED; SetMenuItemInfo(popupMenu, GetMenuItemID(soundOptions, i), 0, &checkInfo); } }}
开发者ID:haywoodsloan,项目名称:Netflix_and_Game,代码行数:23,
示例25: GenerateSystemCommandMapvoid GenerateSystemCommandMap(HWND handle) { HMENU systemMenu = GetSystemMenu(handle, FALSE); if (!systemMenu) return; for (int i = 0; i < GetMenuItemCount(systemMenu); i++) { UINT id = GetMenuItemID(systemMenu, i); MENUITEMINFO mii; ZeroMemory(&mii, sizeof mii); mii.cbSize = sizeof mii; mii.fMask = MIIM_ID | MIIM_STRING | MIIM_BITMAP; WCHAR data[MAX_PATH]; mii.dwTypeData = data; mii.cch = _countof(data); switch (id) { case SC_RESTORE: GetMenuItemInfo(systemMenu, id, FALSE, &mii); menuItemInfoMap[RESTORE] = mii; menuItemStringMap[RESTORE] = mii.dwTypeData; break; case SC_MAXIMIZE: GetMenuItemInfo(systemMenu, id, FALSE, &mii); menuItemInfoMap[MAXIMIZE] = mii; menuItemStringMap[MAXIMIZE] = mii.dwTypeData; break; case SC_MINIMIZE: GetMenuItemInfo(systemMenu, id, FALSE, &mii); menuItemInfoMap[MINIMIZE] = mii; menuItemStringMap[MINIMIZE] = mii.dwTypeData; break; case SC_MOVE: GetMenuItemInfo(systemMenu, id, FALSE, &mii); menuItemInfoMap[MOVE] = mii; menuItemStringMap[MOVE] = mii.dwTypeData; break; case SC_SIZE: GetMenuItemInfo(systemMenu, id, FALSE, &mii); menuItemInfoMap[SIZE] = mii; menuItemStringMap[SIZE] = mii.dwTypeData; break; case SC_CLOSE: GetMenuItemInfo(systemMenu, id, FALSE, &mii); menuItemInfoMap[CLOSE] = mii; menuItemStringMap[CLOSE] = mii.dwTypeData; break; default: break; } }}
开发者ID:276361270,项目名称:hex,代码行数:50,
示例26: MenuSpellChosen/* * MenuSpellChosen: The spell with the given command id in the spell menu was chosen. */void MenuSpellChosen(int id){ int len, num=0, index=0, i; char item_name[MAXRSCSTRING + 1]; spell *sp; HMENU submenu = NULL; if (spell_menu == NULL) return; for (i=0; i < num_schools; i++) { submenu = submenus[i]; if (submenu) { num = GetMenuItemCount(submenu); // Look for menu item matching command id for (index = 0; index < num; index++) { if (GetMenuItemID(submenu, index) == (UINT) id) break; } if (index != num) break; } } if (index == num) { debug(("MenuSpellChosen couldn't find menu id #%d/n", id)); return; } len = GetMenuString(submenu, index, item_name, MAXRSCSTRING, MF_BYPOSITION); if (len == 0) { debug(("MenuSpellChosen get spell #%d from menu/n", index)); return; } sp = FindSpellByName(item_name); if (sp == SPELL_NOMATCH || sp == SPELL_AMBIGUOUS) { debug(("MenuSpellChosen couldn't find spell %s/n", item_name)); return; } PerformAction(A_CASTSPELL, sp);}
开发者ID:xFirekatx,项目名称:Meridian59_103,代码行数:53,
示例27: ASSERT// this one copies the menu without deleting the rootBOOL CSkinBase::CopyMenu(const HMENU hScr, HMENU hDest){ ASSERT (::IsMenu(hDest)); if (!::IsMenu(hDest)) return FALSE; ASSERT (::IsMenu(hScr)); if (!::IsMenu(hScr)) return FALSE; // delete all the existing items while (GetMenuItemCount(hDest)) DeleteMenu(hDest, 0, MF_BYPOSITION); // copy across int nNumItems = GetMenuItemCount(hScr); CString sLabel; MENUITEMINFO mii; ZeroMemory(&mii, sizeof(mii)); mii.cbSize = sizeof(mii); // must fill up this field mii.fMask = MIIM_STATE | MIIM_DATA; // get the state of the menu item for (int nItem = 0; nItem < nNumItems; nItem++) { UINT uIDItem = GetMenuItemID(hScr, nItem); GetMenuString(hScr, nItem, sLabel, MF_BYPOSITION); UINT uFlags = (uIDItem == 0) ? MF_SEPARATOR : (uIDItem == (UINT)-1) ? MF_POPUP : MF_STRING; // special case: if a popup menu we must copy it too if (uFlags == MF_POPUP) { HMENU hPopup = MakeMenuCopy(GetSubMenu(hScr, nItem)); ASSERT (hPopup); uIDItem = (UINT)hPopup; } AppendMenu(hDest, uFlags, uIDItem, sLabel); // make sure we copy the state too ::GetMenuItemInfo(hSrc, nItem, TRUE, &mii); ::SetMenuItemInfo(hDest, nItem, TRUE, &mii); } return TRUE;}
开发者ID:3rdexp,项目名称:jezzitest,代码行数:50,
示例28: set_visiblestatic void set_visible(int i) { char *txt; visible=i; /* setup global variable */ CheckMenuItem(hpopup, GetMenuItemID(hpopup, 1), visible?MF_CHECKED:MF_UNCHECKED); /* check or uncheck menu item */ if(visible) { txt=log_txt(); SetWindowText(EditControl, txt); /* setup window content */ free(txt); ShowWindow(hwnd, SW_SHOWNORMAL); /* show window */ SetForegroundWindow(hwnd); /* bring on top */ } else ShowWindow(hwnd, SW_HIDE); /* hide window */}
开发者ID:OPSF,项目名称:uClinux,代码行数:15,
示例29: winDialogMDIFrameProcstatic LRESULT CALLBACK winDialogMDIFrameProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp){ LRESULT result; HWND hWndClient = NULL; Ihandle *ih = iupwinHandleGet(hwnd); if (!ih) { /* the first time WM_GETMINMAXINFO is called, Ihandle is not associated yet */ if (msg == WM_GETMINMAXINFO && winMinMaxHandle) { if (winDialogCheckMinMaxInfo(winMinMaxHandle, (MINMAXINFO*)lp)) return 0; } return DefFrameProc(hwnd, hWndClient, msg, wp, lp); } { Ihandle* client = (Ihandle*)iupAttribGet(ih, "MDICLIENT_HANDLE"); if (client) hWndClient = client->handle; } if (winDialogBaseProc(ih, msg, wp, lp, &result)) return result; if (msg == WM_MENUCOMMAND) { int menuId = GetMenuItemID((HMENU)lp, (int)wp); if (menuId >= IUP_MDI_FIRSTCHILD && hWndClient) { /* we manually activate the MDI child when its menu item is selected. */ HWND hChild = GetDlgItem(hWndClient, menuId); if (hChild) SendMessage(hWndClient, WM_MDIACTIVATE, (WPARAM)hChild, 0); } else if (menuId >= SC_SIZE && menuId <= SC_CONTEXTHELP) { /* we manually forward the message to the MDI child */ HWND hChild = (HWND)SendMessage(hWndClient, WM_MDIGETACTIVE, 0, 0); if (hChild) SendMessage(hChild, WM_SYSCOMMAND, (WPARAM)menuId, 0); } } return DefFrameProc(hwnd, hWndClient, msg, wp, lp);}
开发者ID:xubingyue,项目名称:iup,代码行数:46,
注:本文中的GetMenuItemID函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetMenuItemInfo函数代码示例 C++ GetMenuItemCount函数代码示例 |