当前位置: 首页>>代码示例>>C++>>正文


C++ InsertMenu函数代码示例

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


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

示例1: getContextMenu

void TabsCtrl::processPopupMenu( bool cmdBar, int posX, int posY ) {

    HMENU hmenu = getContextMenu();
    menuUserCmds(hmenu);

    if (hmenu==NULL) return;

    if (!cmdBar && activeTab>0) {
        BOOL result=InsertMenu(hmenu, 0, MF_STRING | MF_BYPOSITION, TabsCtrl::CLOSETAB, TEXT("Close"));
        result=InsertMenu(hmenu, 1, MF_SEPARATOR | MF_BYPOSITION, 0, NULL);
    }

    HWND hWnd=getHWnd();

    POINT pt={posX, posY };
    if (!cmdBar) ClientToScreen(hWnd, &pt);
    int cmd=TrackPopupMenuEx(hmenu,
        (cmdBar)? (TPM_BOTTOMALIGN | TPM_RETURNCMD) : (TPM_TOPALIGN | TPM_RETURNCMD),
        pt.x, pt.y,
        hWnd,
        NULL);

    if (cmd!=0) {
        MENUITEMINFO mi;
        mi.cbSize=sizeof(mi);
        mi.fMask=MIIM_DATA;
        GetMenuItemInfo(hmenu, cmd, FALSE, &mi);

        if (cmd>=TabsCtrl::SWITCH_TAB && cmd<TabsCtrl::USERCMD) {
            ODR *wt=(ODR*)((void *) mi.dwItemData);
            //switch to the selected tab
            switchByODR(wt);
        }

        if (cmd>=TabsCtrl::USERCMD) {
            menuUserActions(cmd, mi.dwItemData);
        }

        if (cmd==TabsCtrl::CLOSETAB) {
            PostMessage(hWnd, WM_COMMAND, cmd, mi.dwItemData);
        }
    }
    DestroyMenu(hmenu);
}
开发者ID:Tallefer,项目名称:bombusng-md,代码行数:44,代码来源:TabCtrl.cpp

示例2: InsertMenu

/// shell view callback
HRESULT STDMETHODCALLTYPE ShellBrowser::MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    if (uMsg == SFVM_INITMENUPOPUP) {
        ///@todo never reached
        InsertMenu((HMENU)lParam, 0, MF_BYPOSITION, 12345, TEXT("TEST ENTRY"));
        return S_OK;
    }

    return E_NOTIMPL;
}
开发者ID:svn2github,项目名称:ros-explorer,代码行数:11,代码来源:shellbrowser.cpp

示例3: show_popup_menu

void
show_popup_menu ()
{
    POINT pt;
    GetCursorPos (&pt);

    menu = CreatePopupMenu();
    InsertMenu (menu, 0xFFFFFFFF, MF_BYPOSITION | MF_STRING,
                ID_PROPERTIES, "&Properties");
    InsertMenu (menu, 0xFFFFFFFF, MF_BYPOSITION | MF_STRING,
                ID_ABOUT, "&About");
    InsertMenu (menu, 0xFFFFFFFF, MF_BYPOSITION | MF_STRING,
                ID_CLOSE, "&Close");

    SetForegroundWindow (msg_window);
    TrackPopupMenu (menu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_BOTTOMALIGN,
                    pt.x, pt.y, 0, msg_window, NULL);
    SendMessage (msg_window, WM_NULL, 0, 0);
}
开发者ID:BackupTheBerlios,项目名称:quitter,代码行数:19,代码来源:trayicon.c

示例4: build_separator

/*
 * menu_item_builder to build a Windows-specific menu separator
 *
 * Always returns FALSE so the menu engine does not track this item
 */
BOOL build_separator(struct git_data *data, const struct menu_item *item,
		     void *platform)
{
	struct windows_menu_data *windows_menu = platform;
	InsertMenu(windows_menu->menu, windows_menu->index,
		MF_SEPARATOR | MF_BYPOSITION, 0, "");
	windows_menu->index++;

	return FALSE;
}
开发者ID:1212freshman,项目名称:Git-Cheetah,代码行数:15,代码来源:menu.c

示例5: glutChangeToMenuEntry

void FGAPIENTRY glutChangeToMenuEntry(int num, const char *label, int value)
{
	SFG_WinMenuItem *item;
	int i;
#ifdef UNICODE
	WCHAR *wlabel;
#endif
	if (fgMappedMenu)
		menuModificationError();
	
	i = fgCurrentMenu->Num;
	item = fgCurrentMenu->List;
	while (item) 
	{
		if (i == num) 
		{
			if (item->IsTrigger) 
			{
			/* If changing a submenu trigger to a menu entry, we
				need to account for submenus.  */
				item->Menu->SubMenus--;
			}
			
			free(item->Label);
			item->Label = _strdup(label);
			if (!item->Label) 
				fgError("out of memory");
			item->IsTrigger = FALSE;
			item->Len = (int) strlen(label);
			item->Value = value;
			item->Unique = UniqueMenuHandler++;
			
#ifdef UNICODE
			wlabel = (WCHAR*)malloc((item->Len + 1) * sizeof(WCHAR));
			mbstowcs(wlabel, label, item->Len + 1);
#endif
			RemoveMenu(fgCurrentMenu->Handle, (UINT) i - 1, MF_BYPOSITION);
			InsertMenu(fgCurrentMenu->Handle, (UINT) i - 1, MF_BYPOSITION | MFT_STRING, item->Unique, 
#ifdef UNICODE
				wlabel
#else
				label
#endif
				);
#ifdef UNICODE
			free(wlabel);
#endif
			
			return;
		}
		i--;
		item = item->Next;
	}
	fgWarning("Current menu has no %d item.", num);
}
开发者ID:damiannz,项目名称:glutes,代码行数:55,代码来源:glutes_menu.c

示例6: SetUpMenus

SetUpMenus()
  {
   /*================================================*/
   /* Get the Apple menu from the resource file, add */
   /* the names of available desk accessories, and   */
   /* install it at the end of the menu bar.         */
   /*================================================*/
   
   AppleMenu = GetMenu(AppleID);
   AddResMenu(AppleMenu,'DRVR');
   InsertMenu(AppleMenu,0);
   
   /*==============================================*/
   /* Get the File menu from the resource file and */
   /* install it at the end of the menu bar.       */
   /*==============================================*/
   
   FileMenu = GetMenu(FileID);
   InsertMenu(FileMenu,0);
   
   /*==============================================*/
   /* Get the Edit menu from the resource file and */
   /* install it at the end of the menu bar.       */
   /*==============================================*/
   
   EditMenu = GetMenu(EditID);
   InsertMenu(EditMenu,0);
   
   /*=============================================*/
   /* Get the Options menu from the resource file */
   /* and install it at the end of the menu bar.  */
   /*=============================================*/
   
   OptionsMenu = GetMenu(OptionsID);
   InsertMenu(OptionsMenu,0);
   
   /*======================================*/
   /* Show the new menu bar on the screen. */
   /*======================================*/
   
   DrawMenuBar();
  }  
开发者ID:marcinch18,项目名称:nasa-cosmic,代码行数:42,代码来源:CRSVMAC.C

示例7: 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

示例8: MAKE_HRESULT

HRESULT CContextMenuExt::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("Syncany Context Menu") );

	return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, 1 );
}
开发者ID:greenboxindonesia,项目名称:syncany,代码行数:11,代码来源:ContextMenuExt.cpp

示例9: MAKE_HRESULT

//add by ray 2014-05-15 17:48
HRESULT CSimpleShlExt::QueryContextMenu ( HMENU hmenu,UINT uMenuIndex, UINT uidFirstCmd, UINT uidLastCmd, UINT uFlags )
{          
	// 如果标志包含 CMF_DEFAULTONLY 我们不作任何事情. 
	if ( uFlags & CMF_DEFAULTONLY ) 
	{ 
		return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, 0 ); 
	} 

	InsertMenu ( hmenu, uMenuIndex, MF_BYPOSITION, uidFirstCmd, _T("SimpleShlExt Test Item") ); 
	return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, 1 );
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:12,代码来源:SimpleShlExt.cpp

示例10: SetUpMenus

static void SetUpMenus ()
{
  int i;

  for (i=0; i<menuCount; i++)
    myMenus[i] = GetMenu(i+appleID);
  AppendResMenu(myMenus[0],'DRVR');
  for (i=0; i<menuCount; i++)
    InsertMenu(myMenus[i],0);                                           /* Add menus to menu bar */
  DrawMenuBar();
}
开发者ID:rolk,项目名称:ug,代码行数:11,代码来源:ugView.c

示例11: SetMessageHandler

void VirtualDimension::UnShrink(void)
{
	RECT pos;
	DWORD style;

	if (!m_shrinked)
	return;

	//Change the method to use for painting the window
	SetMessageHandler(WM_PAINT, deskMan, &DesktopManager::OnPaint);

	//Restore the window's style
	style = GetWindowLong(m_hWnd, GWL_STYLE);
	style |= (m_hasCaption ? WS_CAPTION : WS_DLGFRAME);
	style |= (m_lockPreviewWindow ? 0 : WS_THICKFRAME);
	SetWindowLongPtr(m_hWnd, GWL_STYLE, style);

	if (!m_lockPreviewWindow)
	{
		InsertMenu(m_pSysMenu, 0, MF_BYPOSITION, SC_SIZE, TEXT("&Size"));
		InsertMenu(m_pSysMenu, 0, MF_BYPOSITION, SC_MOVE, TEXT("&Move"));
	}

	//Restore the windows position
	pos.left = m_location.x;
	pos.right = pos.left + deskMan->GetWindowWidth();
	pos.top = m_location.y;
	pos.bottom = pos.top + deskMan->GetWindowHeight();
	AdjustWindowRectEx(&pos, GetWindowLong(m_hWnd, GWL_STYLE), FALSE, GetWindowLong(m_hWnd, GWL_EXSTYLE));

	//Apply the changes
	SetWindowPos(m_hWnd, NULL, pos.left, pos.top, pos.right-pos.left, pos.bottom-pos.top, SWP_DRAWFRAME | SWP_NOZORDER | SWP_FRAMECHANGED);

	//Enable tooltips
	tooltip->ShowTooltips(true);

	//Refresh the display
	Refresh();

	m_shrinked = false;
}
开发者ID:HaijinW,项目名称:VirtualDimension,代码行数:41,代码来源:VirtualDimension.cpp

示例12: InsertMenu

HRESULT CContextMenuHandler::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
{
	if (!(uFlags & CMF_DEFAULTONLY))
	{
		CString strResizeItem;
		strResizeItem.LoadString(IDS_RESIZEITEM);
		
		InsertMenu(hmenu, indexMenu, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_PHOTORESIZE, strResizeItem);
	}

	return MAKE_HRESULT(SEVERITY_SUCCESS, 0, IDM_PHOTORESIZE + 1);
}
开发者ID:rahulkargwal25,项目名称:PubRepo,代码行数:12,代码来源:ContextMenuHandler.cpp

示例13: switch_menu_pl

static void switch_menu_pl()
{
	DeleteMenu(g_hMenuView, IDM_OF_VIEW_ALL, MF_BYCOMMAND);
	DeleteMenu(g_hMenuView, IDM_OF_PL_UP, MF_BYCOMMAND);
	DeleteMenu(g_hMenuView, IDM_OF_PL_DOWN, MF_BYCOMMAND);
	DeleteMenu(g_hMenuView, IDM_OF_PL_CLEAR, MF_BYCOMMAND);
	
	if (playlist_mode) {
		InsertMenu(g_hMenuView, 0, MF_BYPOSITION, IDM_OF_PL_CLEAR, _T("Clear"));
		InsertMenu(g_hMenuView, 0, MF_BYPOSITION, IDM_OF_PL_DOWN, _T("Move Down") );
		InsertMenu(g_hMenuView, 0, MF_BYPOSITION, IDM_OF_PL_UP, _T("Move Up") );
	} else {
		InsertMenu(g_hMenuView, 0, MF_BYPOSITION, IDM_OF_VIEW_ALL, _T("All Unknown Files") );
	}
	TBBUTTONINFO tbbi; 
	tbbi.cbSize = sizeof(tbbi); 
	tbbi.dwMask = TBIF_TEXT; 
	tbbi.pszText = playlist_mode ? _T("Remove") : _T("Add"); 
	SendMessage(g_hWndMenuBar, TB_SETBUTTONINFO, IDM_OF_PL_ACT, (LPARAM)&tbbi); 
	refresh_menu_states();
}
开发者ID:DmitrySigaev,项目名称:gpac_hbbtv,代码行数:21,代码来源:openfile.cpp

示例14: MAKE_HRESULT

STDMETHODIMP CFdmUplShlExt::QueryContextMenu(HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd, UINT idCmdLast, UINT uFlags)
{
	if (uFlags & CMF_DEFAULTONLY)
		return MAKE_HRESULT (SEVERITY_SUCCESS, FACILITY_NULL, 0);

	char sz [1000] = "";

	CRegKey key;
	if (ERROR_SUCCESS == key.Open (HKEY_CURRENT_USER, 
			"Software\\FreeDownloadManager.ORG\\Free Upload Manager\\Settings\\Integration", KEY_READ))
	{
		DWORD dw = sizeof (sz);
		key.QueryValue (sz, "UploadString", &dw);
	}

	InsertMenu (hmenu, uMenuIndex++, MF_BYPOSITION, MF_SEPARATOR, 0);
	InsertMenu (hmenu, uMenuIndex, MF_BYPOSITION, uidFirstCmd, *sz ? sz : "Upload");
	
	
	return MAKE_HRESULT (SEVERITY_SUCCESS, FACILITY_NULL, 2);
}
开发者ID:ratever930,项目名称:freedownload,代码行数:21,代码来源:FdmUplShlExt.cpp

示例15: InsertMenu

IFACEMETHODIMP OCContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
{
	HRESULT hr;

	if (!(CMF_DEFAULTONLY & uFlags))
	{
		InsertMenu(hMenu, indexMenu, MF_STRING | MF_BYPOSITION,	idCmdFirst + IDM_SHARE,	L"&Share with ownCloud");
	}
	hr = StringCbCopyW(m_pwszVerb, sizeof(m_pwszVerb), L"ownCloudShare");

	return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(IDM_SHARE + 1));
}
开发者ID:24killen,项目名称:client,代码行数:12,代码来源:OCContextMenu.cpp


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