• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetMenuItemID函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetMenuItemID函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMenuItemID函数的具体用法?C++ GetMenuItemID怎么用?C++ GetMenuItemID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetMenuItemID函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: playermenu_find_unique_id

WORD 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,代码来源:modules.cpp


示例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,代码来源:MainWnd.cpp


示例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,代码来源:wmdisim.c


示例4: GetMenuItemCount

void 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,代码来源:menu_manager.cpp


示例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,代码来源:trayicon.cpp


示例6: GetMenuItemID

void 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,代码来源:FrameWnd.cpp


示例7: LuaGuiGetMenuItemId

	static uint32_t LuaGuiGetMenuItemId(void *hMenu, uint32_t position)
	{
		return GetMenuItemID(
			reinterpret_cast<HMENU>(hMenu),
			position
			);
	}
开发者ID:myeang1,项目名称:YDWE,代码行数:7,代码来源:luaopen_gui.cpp


示例8: CompositeCMenu_HandleMenuMsg

static 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,代码来源:shlmenu.c


示例9: menucpy

void 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,代码来源:Edittime.cpp


示例10: ASSERT

HMENU 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,代码来源:winmdi.cpp


示例11: BiasMenu

VOID 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,代码来源:wfinit.c


示例12: CreateMenu

HMENU 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,代码来源:fsODMenu.cpp


示例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,代码来源:FloatingWnd.cpp


示例14: UINT

BOOL 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,代码来源:RecBinViewer.cpp


示例15: InitMenuPopup

static 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,代码来源:clipbrd.c


示例16: set_visible

static 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,代码来源:gui.cpp


示例17: hugsprim_GetMenuItemID_14

static 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,代码来源:Menu.c


示例18: GetIndexOfItem

INT 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,代码来源:hook.cpp


示例19: while

unsigned 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,代码来源:win32_popup.cpp


示例20: UpdMenu

BOOL CALLBACK
UpdMenu(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,代码来源:rbtray.c



注:本文中的GetMenuItemID函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetMenuItemInfo函数代码示例发布时间:2022-05-30
下一篇:
C++ GetMenuItemCount函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap