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

C++ GetMenuItemInfo函数代码示例

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

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



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

示例1: LoadMenu

//----------------------------------------------------------------------------------------------
//	ShowRightPopupMenu
//----------------------------------------------------------------------------------------------
VOID CStatusAreaIcon::ShowRightPopupMenu()
{
	//	プロパティ シートの状態を取得する
	BOOL	PropertySheetOpened	= PropertySheet->IsOpened();

	//	ポップアップ メニューを作成する
	HMENU	Menu		= LoadMenu( Instance, MAKEINTRESOURCE( IDR_MENU ) );
	HMENU	PopupMenu	= GetSubMenu( Menu, 0 );

	//	「プロパティ」をデフォルトにする
	MENUITEMINFO	ItemInfo;
	ZeroMemory( &ItemInfo, sizeof( ItemInfo ) );
	ItemInfo.cbSize	= sizeof( ItemInfo );
	GetMenuItemInfo( PopupMenu, IDM_PROPERTY, FALSE, &ItemInfo );
	ItemInfo.fMask	= MIIM_STATE;
	ItemInfo.fState	= MFS_ENABLED | MFS_DEFAULT;
	if( PropertySheetOpened == TRUE )
	{
		ItemInfo.fState	|= MFS_DISABLED;
	}
	SetMenuItemInfo( PopupMenu, IDM_PROPERTY, FALSE, &ItemInfo );

	//	「設定の自動切換え」のチェックを設定する
	GetMenuItemInfo( PopupMenu, IDM_AUTO_SETTING_CHANGE, FALSE, &ItemInfo );
	ItemInfo.fMask	= MIIM_STATE;
	ItemInfo.fState	= MFS_ENABLED;
	if( Setting->AutoSettingChange == TRUE )
	{
		ItemInfo.fState	|= MFS_CHECKED;
	}
	if( PropertySheetOpened == TRUE )
	{
		ItemInfo.fState	|= MFS_DISABLED;
	}
	SetMenuItemInfo( PopupMenu, IDM_AUTO_SETTING_CHANGE, FALSE, &ItemInfo );

	//	「終了」の有効・無効を設定する
	GetMenuItemInfo( PopupMenu, IDM_EXIT, FALSE, &ItemInfo );
	ItemInfo.fMask	= MIIM_STATE;
	ItemInfo.fState	= MFS_ENABLED;
	if( PropertySheetOpened == TRUE )
	{
		ItemInfo.fState	|= MFS_DISABLED;
	}
	SetMenuItemInfo( PopupMenu, IDM_EXIT, FALSE, &ItemInfo );

	//	ポップアップ メニューを表示する
	SetForegroundWindow( Wnd );
	POINT	CursorPos;
	GetCursorPos( &CursorPos );
	TrackPopupMenuEx(
		 PopupMenu
		,TPM_LEFTALIGN | TPM_RIGHTBUTTON
		,CursorPos.x
		,CursorPos.y
		,Wnd
		,NULL );
	DestroyMenu( Menu );
	PostMessage( Wnd, WM_NULL, 0, 0 );
}
开发者ID:MasashiWada,项目名称:Xbox360-Controller-Driver,代码行数:63,代码来源:status_area_icon.cpp


示例2: onConfigMenuCommand

BOOL    onConfigMenuCommand(HWND hWnd, DWORD id)
{
	wchar_t path[MAX_PATH+1];
    get_directory_path(path);

	MENUITEMINFO mii;
	memset(&mii, 0, sizeof(mii));
	mii.cbSize = sizeof(mii);
	mii.fMask = MIIM_TYPE | MIIM_ID;
    mii.fType = MFT_STRING;

	HMENU hMenu = GetSystemMenu(hWnd, FALSE);
    if (GetMenuItemInfo(hMenu, id, 0, &mii))
    {
        wchar_t sz[MAX_PATH+1], filepath[MAX_PATH+1];
        mii.dwTypeData = sz;
        mii.cch++;
        GetMenuItemInfo(hMenu, id, 0, &mii);
        wsprintf(filepath, L"%s\\%s", path, sz);
        /* need to open file and update config here */
        MessageBox(hWnd, filepath, L"", MB_OK);
		reloadConfig(filepath);
    }

    return(TRUE);
}
开发者ID:u338steven,项目名称:afxtools,代码行数:26,代码来源:misc.cpp


示例3: DeleteAllBitmaps

void DeleteAllBitmaps (HWND hwnd)
{
     HMENU        hMenu ;
     int          i ;
     MENUITEMINFO mii = { sizeof (MENUITEMINFO), MIIM_SUBMENU | MIIM_TYPE } ;

          // Delete Help bitmap on system menu

     hMenu = GetSystemMenu (hwnd, FALSE);
     GetMenuItemInfo (hMenu, IDM_HELP, FALSE, &mii) ;
     DeleteObject ((HBITMAP) mii.dwTypeData) ;

          // Delete top-level menu bitmaps

     hMenu = GetMenu (hwnd) ;

     for (i = 0 ; i < 3 ; i++)
     {
          GetMenuItemInfo (hMenu, i, TRUE, &mii) ;
          DeleteObject ((HBITMAP) mii.dwTypeData) ;
     }

          // Delete bitmap items on Font menu

     hMenu = mii.hSubMenu ;;

     for (i = 0 ; i < 3 ; i++)
     {
          GetMenuItemInfo (hMenu, i, TRUE, &mii) ;
          DeleteObject ((HBITMAP) mii.dwTypeData) ;
     }
}
开发者ID:Jeanhwea,项目名称:petzold-pw5e,代码行数:32,代码来源:GrafMenu.c


示例4: FindSortedPos

// find sorted position after the last separator
int FindSortedPos(HMENU hMenu, const char* text)
{
	int pos = -1, nbItems = GetMenuItemCount(hMenu);
#ifdef _WIN32
	wchar_t widetext[4096], widebuf[4096];
	MultiByteToWideChar(CP_UTF8, 0, text, -1, widetext, 4096);
	_locale_t locale = _create_locale(LC_ALL, "");
#else
	char buf[4096] = "";
#endif
	MENUITEMINFO mi = {sizeof(MENUITEMINFO),};
	mi.fMask = MIIM_TYPE;

	for (int i=nbItems-1; i>=0 ; i--)
	{
		GetMenuItemInfo(hMenu, i, true, &mi);
		if (mi.fType == MFT_SEPARATOR)
			break;
#ifdef _WIN32
		GetMenuStringW(hMenu, i, widebuf, 4096, MF_BYPOSITION);
		if (_wcsnicoll_l(widetext, widebuf, 4096, locale) < 0) // setLocale() can break things (atof and comma as a decimal mark) so use temporary locale object
			pos = i;
#else
		GetMenuString(hMenu, i, buf, sizeof(buf), MF_BYPOSITION);
		if (strcasecmp(text, buf) < 0) // not as good as on Win OS, e.g. French "Sélectionner" vs "Supprimer"
			pos = i;
#endif
	}
#ifdef _WIN32
	_free_locale(locale);
#endif
	return pos<0 ? nbItems : pos;
}
开发者ID:AusRedNeck,项目名称:sws,代码行数:34,代码来源:Menus.cpp


示例5: LocalizeMenu

void LocalizeMenu(HMENU hMenu, LocaleStringLookup *lookup)
{
    if(!lookup) lookup = locale;

    int itemCount = GetMenuItemCount(hMenu);
    if(itemCount == -1)
        return;

    bool bRTL = LocaleIsRTL(lookup);

    for(int i=0; i<itemCount; i++)
    {
        MENUITEMINFO mii;
        zero(&mii, sizeof(mii));
        mii.cbSize = sizeof(mii);
        mii.fMask = MIIM_SUBMENU|MIIM_STRING|MIIM_FTYPE;
        GetMenuItemInfo(hMenu, i, TRUE, &mii);

        if(mii.fType & MFT_SEPARATOR || mii.cch < 2)
            continue;

        HMENU hSubMenu = mii.hSubMenu;

        String strLookup;
        strLookup.SetLength(mii.cch);

        mii.fMask = MIIM_STRING;
        mii.dwTypeData = strLookup.Array();
        mii.cch = strLookup.Length()+1;
        GetMenuItemInfo(hMenu, i, TRUE, &mii);

        String strName;
        if(strLookup[0] == '.')
            strName = strLookup.Array()+1;
        else if(!lookup->HasLookup(strLookup))
            strName = strLookup;
        else
            strName = lookup->LookupString(strLookup);

        mii.fMask = MIIM_STRING|MIIM_FTYPE;
        mii.dwTypeData = strName.Array();

        SetMenuItemInfo(hMenu, i, TRUE, &mii);

        if(hSubMenu)
            LocalizeMenu(hSubMenu);
    }
}
开发者ID:Demiguise,项目名称:OBS,代码行数:48,代码来源:OBSApi.cpp


示例6: LocalizeMenu

void LocalizeMenu(HMENU hMenu) {
	if (Localization == NULL)
		return;

	MENUITEMINFO mii;
	mii.cbSize = sizeof(mii);
	mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_DATA;

	UINT idx = 0;
	while (GetMenuItemInfo(hMenu, idx, TRUE, &mii)) {
		if (mii.fType == MFT_STRING) {
			TCHAR *str = Localization->GetStr(mii.wID);
			if (str != NULL) {
				mii.cbSize = sizeof(mii);
				mii.fMask = MIIM_TYPE;
				mii.dwTypeData = (LPTSTR) str;
				mii.cch = wcslen(str);
				SetMenuItemInfo(hMenu, idx, TRUE, &mii);
			}
		}

		idx++;

		mii.cbSize = sizeof(mii);
		mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_DATA;
	}
}
开发者ID:ardy30,项目名称:tman,代码行数:27,代码来源:Localization.cpp


示例7: RUNTIME_CLASS

void CDownloadMonitorDlg::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
	CMainWnd* pMainWnd = (CMainWnd*)AfxGetMainWnd();
	if ( ! pMainWnd || ! IsWindow( pMainWnd->m_hWnd ) ) return;

	CDownloadsWnd* pDownWnd = (CDownloadsWnd*)pMainWnd->m_pWindows.Find( RUNTIME_CLASS(CDownloadsWnd) );
	if ( ! pDownWnd ) return;

	if ( ! pDownWnd->Select( m_pDownload ) ) return;

	CMenu* pPopup = ::Skin.GetMenu( _T("CDownloadsWnd.Download") );
	if ( ! pPopup ) return;

	MENUITEMINFO pInfo;
	pInfo.cbSize	= sizeof(pInfo);
	pInfo.fMask		= MIIM_STATE;
	GetMenuItemInfo( pPopup->GetSafeHmenu(), m_pDownload->IsCompleted() ?
		ID_DOWNLOADS_LAUNCH_COMPLETE : ID_DOWNLOADS_LAUNCH_COPY, FALSE, &pInfo );
	pInfo.fState	|= MFS_DEFAULT;
	SetMenuItemInfo( pPopup->GetSafeHmenu(), m_pDownload->IsCompleted() ?
		ID_DOWNLOADS_LAUNCH_COMPLETE : ID_DOWNLOADS_LAUNCH_COPY, FALSE, &pInfo );

	CoolMenu.AddMenu( pPopup, TRUE );

	UINT nID = pPopup->TrackPopupMenu( TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON|TPM_RETURNCMD,
		point.x, point.y, pDownWnd );

	if ( nID && pDownWnd->Select( m_pDownload ) )
	{
		pDownWnd->SendMessage( WM_COMMAND, nID );
	}
}
开发者ID:ivan386,项目名称:Shareaza,代码行数:32,代码来源:DlgDownloadMonitor.cpp


示例8: menu_search

/**
 * Search a menu for an item containing the given data.
 *
 * @param menu Menu handle
 * @param data Pointer to menu item data
 * @return Item number within menu, or -1 if not found or error
 */
static int
menu_search(HMENU menu, const char *data)
{
	int item, count;

	count = GetMenuItemCount(menu);
	if (count == -1) {
		return -1;
	}

	for (item = 0; item < count; item++) {
		MENUITEMINFO mii;
		char buffer[1024];

		/* Retrieve the string if this menu item contains string data */
		buffer[0] = '\0';
		mii.cbSize = sizeof(MENUITEMINFO);
		mii.fMask = MIIM_STRING;
		mii.dwTypeData = buffer;
		mii.cch = sizeof(buffer);
		if (GetMenuItemInfo(menu, item, TRUE, &mii) == 0) {
			return -1;
		}

		/* Compare with given data */
		if (strcmp(buffer, data) == 0) {
			return item;
		}
	}

	return -1;
}
开发者ID:dwhinham,项目名称:rpcemu,代码行数:39,代码来源:rpc-win.c


示例9: menu_t

		menu_t( HWND hwnd, boost::string_ref path, boost::string_ref root_name ) :
			root_( winapi::load_menu( path, ID ) )
		{
			auto const src = winapi::get_menu( hwnd );
			if( !src ) {
				winapi::message_box( u8"MMAccel", u8"メニューハンドルを取得できません", MB_OK | MB_ICONERROR );
			}

			int index = 0;
			for(  ; index < winapi::get_menu_item_count( src ); ++index ) {
				MENUITEMINFO info;
				info.cbSize = sizeof( info );
				info.fMask = MIIM_FTYPE;
				GetMenuItemInfo( src.get(), index, TRUE, &info );
				if( info.fType & MFT_RIGHTJUSTIFY ) {
					break;
				}
			}

			if( src && !winapi::insert_menu( src, index, winapi::get_sub_menu( root_, 0 ), root_name ) ) {
				winapi::last_error_message_box( u8"MMAccel", u8"insert_menu error" );
			}

			DrawMenuBar( hwnd );
		}
开发者ID:LNSEAB,项目名称:mmaccel,代码行数:25,代码来源:menu.hpp


示例10: DestroyMenuData

BOOL DestroyMenuData(HMENU hMenu, BOOL destroyMenu)
{
   INT i;
   for (i = 0; i < GetMenuItemCount(hMenu); i++)
   {
      MENUITEMINFO menuInf;
      ZeroMemory(&menuInf, sizeof(menuInf));
      menuInf.cbSize = sizeof(menuInf);
      menuInf.fMask = MIIM_DATA | MIIM_SUBMENU;
      if (GetMenuItemInfo(hMenu, i, TRUE, &menuInf))
      {
         pItemData pData = (pItemData)menuInf.dwItemData;
         DestroyIcon(pData->largeIcon);
         DestroyIcon(pData->smallIcon);
         if (pData->extra)
            delete pData->extra;
         delete pData;
      }
      if (menuInf.hSubMenu)
         DestroyMenuData(menuInf.hSubMenu);
   }
   if (destroyMenu)
	   DestroyMenu(hMenu);
   return TRUE;
}
开发者ID:plerup,项目名称:LaunchBar,代码行数:25,代码来源:utils.cpp


示例11: IterateThroughItems

static void IterateThroughItems(HWND WND, HMENU menu, POINT *p)
{
	int count = GetMenuItemCount(menu);
	RECT rec;
	MENUITEMINFO info;
	int i;
	for (i=0; i<count; i++) {
		if (GetMenuItemRect(WND, menu, i, &rec) && (rec.left<=p->x) && (p->x<=rec.right) && (rec.top<=p->y) && (p->y<=rec.bottom)) {
			ZeroMemory(&info, sizeof(info));
			info.cbSize = sizeof(info);
			info.fMask = MIIM_TYPE | MIIM_SUBMENU;
			info.cch = 256;
			info.dwTypeData = malloc(256);
			GetMenuItemInfo(menu, i, TRUE, &info);
			if (info.cch>0) {
				if (info.cch > 255)
					CurParams->WordLen = 255;
				else
					CurParams->WordLen = info.cch;
				CurParams->Unicode = FALSE;
				CurParams->WordLen = MyCopyMemory(CurParams->MatchedWordA, info.dwTypeData, CurParams->WordLen);
				CurParams->BeginPos = 0;
			}
			free(info.dwTypeData);
			break;
		}
	}
}
开发者ID:PurlingNayuki,项目名称:stardictproject,代码行数:28,代码来源:TextOutHook.c


示例12: ZeroMemory

//===========================================================================
void ContextMenu::Copymenu(HMENU hm)
{
	TCHAR text_string[256];
	for (int i = 0; i < GetMenuItemCount(hm); i++)
	{
		MENUITEMINFO info;
		ZeroMemory(&info, sizeof(info));
		info.cbSize = sizeof(MENUITEMINFO_0400); // to make this work on win95
		info.fMask  = MIIM_DATA|MIIM_ID|MIIM_SUBMENU|MIIM_TYPE;
		GetMenuItemInfo (hm, i, TRUE, &info);

		text_string[0]=0;
		if (0 == (info.fType & MFT_OWNERDRAW))
			GetMenuString(hm, i, text_string, 128, MF_BYPOSITION);

		//TCHAR buffer[256]; _stprintf(buffer, _T("%d %s"), info.wID, text_string); _tcscpy(text_string, buffer);

		Menu *CM = NULL;
		if (info.hSubMenu)
		{
			wc->HandleMenuMsg(WM_INITMENUPOPUP, (WPARAM)info.hSubMenu, MAKELPARAM(i, FALSE));
			CM = new ContextMenu(text_string, wc, info.hSubMenu, 0);
		}
		else
		if (info.fType & MFT_SEPARATOR)
		{
			//MakeMenuNOP(this, NULL);
			continue;
		}

		MenuItem *CI = new ContextItem(CM, text_string, info.wID, info.dwItemData, info.fType);
		AddMenuItem(CI);
	}
}
开发者ID:fin-alice,项目名称:bb4nt,代码行数:35,代码来源:Contextmenu.cpp


示例13: ASSERT

BOOL CCoolMenu::ReplaceMenuText(CMenu* pMenu, int nPosition, MENUITEMINFO FAR* mii, LPCTSTR pszText)
{
	if ( ! pMenu || mii == NULL )
		return FALSE;
	ASSERT( mii->dwTypeData );

	int nItemID = pMenu->GetMenuItemID( nPosition );

	if ( ! ModifyMenu( pMenu->GetSafeHmenu(), nPosition, MF_BYPOSITION|MF_STRING, nItemID, pszText ) )
		return FALSE;

	mii->dwTypeData = (LPTSTR)pszText;

	mii->cch = CString( pszText ).GetLength() + 1;
	mii->fMask = MIIM_DATA|MIIM_ID|MIIM_FTYPE|MIIM_STRING;

	// We modified menu, retrieve a new MII (validates and changes data)
	if ( ! GetMenuItemInfo( pMenu->GetSafeHmenu(), nPosition, TRUE, mii ) )
		return FALSE;

	// Replace the corresponding value in the collection
	mii->dwItemData	= ( (DWORD_PTR)pMenu->GetSafeHmenu() << 16 ) | ( mii->wID & 0xFFFF );
	CString strNew( (LPCTSTR)mii->dwTypeData );
	m_pStrings.SetAt( mii->dwItemData, strNew );

	return TRUE;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:27,代码来源:CoolMenu.cpp


示例14: IterateThroughItems

static void IterateThroughItems(HWND WND, HMENU menu, POINT *p)
{
	int count = GetMenuItemCount(menu);
	RECT rec;
	MENUITEMINFO info;
	int i;
	TCHAR buf[MATCHED_WORD_BUF_SIZE];
	for (i=0; i<count; i++) {
		if (GetMenuItemRect(WND, menu, i, &rec) && (rec.left<=p->x) 
			&& (p->x<=rec.right) && (rec.top<=p->y) && (p->y<=rec.bottom)) {
			ZeroMemory(&info, sizeof(info));
			info.cbSize = sizeof(info);
			info.fMask = MIIM_TYPE | MIIM_SUBMENU;
			info.cch = MATCHED_WORD_BUF_SIZE;
			info.dwTypeData = buf;
			GetMenuItemInfo(menu, i, TRUE, &info);
			if (info.cch>0) {
				if (info.cch >= MATCHED_WORD_BUF_SIZE)
					CurParams->WordLen = MATCHED_WORD_BUF_SIZE-1;
				else
					CurParams->WordLen = info.cch;
#ifdef UNICODE
				CurParams->Unicode = TRUE;
				CurParams->WordLen = MyCopyMemory(CurParams->MatchedWordW, info.dwTypeData, CurParams->WordLen);
#else
				CurParams->Unicode = FALSE;
				CurParams->WordLen = MyCopyMemory(CurParams->MatchedWordA, info.dwTypeData, CurParams->WordLen);
#endif
				CurParams->BeginPos = 0;
			}
			break;
		}
	}
}
开发者ID:2php,项目名称:stardict-3,代码行数:34,代码来源:TextOutHook.c


示例15: GetMenuItemInfo

void CaImMenu::MeasureItem (LPMEASUREITEMSTRUCT lpMeasureItemStruct) {
	MENUITEMINFO iInfo;
	GetMenuItemInfo (lpMeasureItemStruct->CtlID, &iInfo);
	CaImMenuItem* pItem = (CaImMenuItem*)lpMeasureItemStruct->itemData;

	CFont fntDef;
	LOGFONT lfDef;
	CClientDC dc (0);
	CFont* pFont = (CFont *)dc.SelectStockObject (ANSI_VAR_FONT);
	if (pItem->CheckStyle (AMIS_DEFAULT)) {
		CFont* pFnt = dc.GetCurrentFont ();
		pFnt->GetLogFont (&lfDef);
		lfDef.lfWeight = FW_BOLD;
		fntDef.CreateFontIndirect (&lfDef);
		dc.SelectObject (&fntDef);
	}

	if (pItem->CheckStyle (AMIS_BAR))
		lpMeasureItemStruct->itemHeight = 4;
	else
		lpMeasureItemStruct->itemHeight = m_dwHeight;
	lpMeasureItemStruct->itemWidth = 25 + 8 + 8 + 2 + dc.GetTextExtent (pItem->GetText ()).cx;

	dc.SelectObject (pFont);
	if (pItem->CheckStyle (AMIS_DEFAULT))
		fntDef.DeleteObject ();
}
开发者ID:macx0r,项目名称:dias-inet,代码行数:27,代码来源:aimmenu.cpp


示例16: _OnMenuUserOption

    static Bool _OnMenuUserOption( WORD wid )
    {
        MENUITEMINFO mi;

        // init
        mi.cbSize = sizeof(mi);
        mi.fMask = MIIM_STATE;

        // get option state
        if(GetMenuItemInfo(_menu, wid, FALSE, &mi))
        {
            // notify
            for( ListenerIterator l = _listeners.Begin(); l != _listeners.End(); ++l )
            {
                // get current state
                Bool enabled = (mi.fState & MFS_CHECKED) != 0;

                // if callback handled
                if((*l)->OnMenuOption(wid - ID_USER, enabled))
                    return true;
            }
        }

        return false;
    }
开发者ID:menghang,项目名称:YoloMouse,代码行数:25,代码来源:ShellUi.cpp


示例17: Menu_CreateMenu

int Menu_CreateMenu(HMENU hSubMenu, int *aImages)
{
    int i;
    int nMenuCount = GetMenuItemCount(hSubMenu);

    for (i = 0; i < nMenuCount; i++)
    {
        int nIndex;

        if ((int)aImages == IDP_TOOLBAR)
            nIndex = IDP_TOOLBAR;
        else if ((int)aImages == IDP_NONE)
            nIndex = IDP_NONE;
        else
            nIndex = aImages[i];

        if (!Menu_InitMenuItem(hSubMenu, i, TRUE, nIndex, 0))
        {
            MENUITEMINFO mii;

            INITSTRUCT(mii, TRUE);
            mii.fMask = MIIM_TYPE | MIIM_SUBMENU;

            GetMenuItemInfo(hSubMenu, i, TRUE, &mii);

            if (mii.hSubMenu != NULL)
            {
                Menu_CreateMenu(mii.hSubMenu, (int *)IDP_TOOLBAR);
            }
        }
    }

    return (nMenuCount);
}
开发者ID:now,项目名称:slackedit,代码行数:34,代码来源:pcp_menu.c


示例18: sizeof

// 1.) because NPP use lets IDs for  menu items 
// and we can not get new IDs for our dynamic menu items. To solve 
// this problem we switch menu message handling from WM_COMMAND to WM_MENUCOMMAND
// see 2.) and 3.)
LRESULT CALLBACK CEditor::WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){

	if (message == WM_MENUCOMMAND){
		CMenuItem* mItem = CMenuItem::GetInstance((HMENU)lParam, wParam);
		if (mItem){ 
			// here we have our menu item
			mItem->call();
		}else{ 
			// we have menu items from NPP
			// simulate WM_COMMAND, NPP handles his menu items self

			MENUITEMINFO mii;
			mii.cbSize = sizeof(mii);
			mii.fMask = MIIM_ID | MIIM_DATA;
			// 2.) WM_MENUCOMMAND + submenu handle and item position help us to
			// get MenuItemInfo without using of menu item ID
			BOOL res = GetMenuItemInfo((HMENU)lParam, wParam, TRUE, &mii);
			if (res)
				::SendMessage(hwnd, WM_COMMAND,mii.wID,0);
		}
	} else if (message == WM_INITMENUPOPUP){
		CMenu* menu = CMenu::GetInstance((HMENU)wParam);
		if (menu){
			menu->oninitpopup();
			return NULL;
		}
	}	

	WNDPROC oldWndProc = (WNDPROC)GetProp(hwnd, SUBCLASSING);

	return CallWindowProc(oldWndProc, hwnd, message, wParam, lParam);

}
开发者ID:Addicted01,项目名称:jn-npp-plugin,代码行数:37,代码来源:Editor.cpp


示例19: LoadString

void Explorerplusplus::OnApplicationToolbarRClick()
{
	MENUITEMINFO mii;

	TCHAR szTemp[64];
	LoadString(m_hLanguageModule,IDS_APPLICATIONBUTTON_NEW,
		szTemp,SIZEOF_ARRAY(szTemp));

	mii.cbSize		= sizeof(mii);
	mii.fMask		= MIIM_ID|MIIM_STRING;
	mii.dwTypeData	= szTemp;
	mii.wID			= IDM_APP_NEW;

	/* Add the item to the menu. */
	InsertMenuItem(m_hToolbarRightClickMenu,7,TRUE,&mii);

	/* Set it to be owner drawn. */
	SetMenuItemOwnerDrawn(m_hToolbarRightClickMenu,7);

	OnMainToolbarRClick();

	mii.cbSize	= sizeof(mii);
	mii.fMask	= MIIM_DATA;
	GetMenuItemInfo(m_hToolbarRightClickMenu,7,TRUE,&mii);

	/* Free the owner drawn data. */
	free((void *)mii.dwItemData);

	/* Now, remove the item from the menu. */
	DeleteMenu(m_hToolbarRightClickMenu,7,MF_BYPOSITION);
}
开发者ID:3scp8,项目名称:explorerplusplus,代码行数:31,代码来源:WindowHandler.cpp


示例20: GetMenuItemInfo

UINT CUIMenu::CheckMenuItem(UINT nIDCheckItem, UINT nCheck)
{
	BOOL bByPosition;
	UI_MENU_ITEM_INFO * lpUIMenuItemInfo;
	UINT nRet = MF_UNCHECKED;

	bByPosition = nCheck & MF_BYPOSITION ? TRUE : FALSE;
	lpUIMenuItemInfo = GetMenuItemInfo(nIDCheckItem, bByPosition);
	if (lpUIMenuItemInfo != NULL && UI_MENU_MAGIC == lpUIMenuItemInfo->nMagic)
	{
		if (nCheck & MF_CHECKED)
		{
			lpUIMenuItemInfo->nState |= MF_CHECKED;
			nRet = MF_CHECKED;
		}
		else
		{
			lpUIMenuItemInfo->nState &= ~MF_CHECKED;
			nRet = MF_UNCHECKED;
		}
	}

	return nRet;
	//return ::CheckMenuItem(m_hMenu, nIDCheckItem, nCheck);
}
开发者ID:StartGit2015,项目名称:PFXLIB,代码行数:25,代码来源:UIMenu.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetMenuItems函数代码示例发布时间:2022-05-30
下一篇:
C++ GetMenuItemID函数代码示例发布时间: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