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

C++ GetMenuString函数代码示例

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

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



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

示例1: mh_getLabel

static const wchar_t* mh_getLabel (menu* m) {
int ll = GetMenuString(m->parent, m->command, NULL, 0, MF_BYCOMMAND);
wchar_t* wc = malloc(sizeof(wchar_t) * (ll+1));
GetMenuString(m->parent, m->command, wc, ll+1, MF_BYCOMMAND);
wc[ll]=0;
wchar_t* z = wcschr(wc, 8);
if (z)  *z=0;
return wc;
}
开发者ID:qtnc,项目名称:6pad,代码行数:9,代码来源:luamenuhandle.c


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


示例3: GetMenuItemCount

void COwnMenu::MakeItemsOwnDraw(BOOL bFirst)
{
	int iMaxItems = GetMenuItemCount();
	for(int i = 0; i < iMaxItems; i++)
	{
		CString nameHolder;
		MenuObject* pObject = new MenuObject;
		deleteItem.push_back((DWORD)pObject);
		pObject->m_hIcon = NULL;
		pObject->bFirstMenu = bFirst;
		GetMenuString(i, pObject->m_strCaption, MF_BYPOSITION);
		MENUITEMINFO mInfo;
		ZeroMemory(&mInfo, sizeof(MENUITEMINFO));
		UINT uID = mInfo.wID; //I dont use GetMenuItemID because it doesn't return 0/-1 when it's a Popup (so the MSDN is wrong)
		ModifyMenu(i, MF_BYPOSITION | MF_OWNERDRAW,
			uID, (char*)pObject);


		if(GetSubMenu(i))
		{
		COwnMenu* pSubMenu = new COwnMenu;
		deleteMenu.push_back((DWORD)pSubMenu);
		pSubMenu->Attach(GetSubMenu(i)->GetSafeHmenu());		
		pSubMenu->MakeItemsOwnDraw();
		}
	}
}
开发者ID:SulfredLee,项目名称:MFC_collections,代码行数:27,代码来源:OwnMenu.cpp


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


示例5: GetCodeTitle

void GetCodeTitle(
    LPEVENTINFOS2 eiPtr,
    short code,
    short param,
    short mn,
    LPSTR strBuf,
    WORD maxLen )
{
	HMENU		hMn;

	// Finds event in array
	eiPtr=GetEventInformations(eiPtr, code);

	// If a special string is to be returned
	short strID = EVINFO2_PARAMTITLE(eiPtr, param);

	if ( strID != 0 )
		LoadString(hInstLib, strID, strBuf, maxLen);
	else
	{
		// Otherwise, returns the menu option 
		if ((hMn = LoadMenu(hInstLib, MAKEINTRESOURCE(mn))) != NULL )
		{
			GetMenuString(hMn, eiPtr->menu, strBuf, maxLen, MF_BYCOMMAND);
			DestroyMenu(hMn);
		}
	}
}
开发者ID:clickteam-plugin,项目名称:ASCII,代码行数:28,代码来源:Edittime.cpp


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


示例7: MenuAddLanguage

/*
 * MenuAddLanguage:  Add given language to Language menu.
 */
void MenuAddLanguage(int lang_id)
{
   int num, index, len;
   char item_name[MAXRSCSTRING + 1], *name = NULL;

   if (lang_id > MAX_LANGUAGE_ID)
      return;

   num = GetMenuItemCount(language_menu);

   for(int i = 0; i < MAX_LANGUAGE_ID; i++)
      if(language_id_table[i].languageid == lang_id)
      {
         name = language_id_table[i].language_name;

         break;
      }

   // Add in sorted order.
   for (index = 0; index < num; index++)
   {
      len = GetMenuString(language_menu, index, item_name, MAXRSCSTRING, MF_BYPOSITION);
      if (len == 0)
         continue;
      if (stricmp(item_name, name) >= 0)
         break;
   }

   // Check for adding to end of list.
   if (index == num)
      index = -1;

   InsertMenu(language_menu, index, MF_STRING | MF_BYPOSITION, 
         ID_LANGUAGE + lang_id, name);
}
开发者ID:GarOfMeridian,项目名称:Meridian59_103,代码行数:38,代码来源:language.c


示例8: kwin_save_file_menu

/*
 * Function: Save the items on the file menu in the KERBEROS.INI file.
 *
 * Parameters:
 *	hwnd - handle of the dialog containing the file menu.
 */
static void
kwin_save_file_menu(HWND hwnd)
{
  HMENU hmenu;
  int i;
  int id;
  int ctitems;
  char menuitem[MAX_K_NAME_SZ + 3];

  hmenu = GetMenu(hwnd);
  assert(hmenu != NULL);

  hmenu = GetSubMenu(hmenu, 0);
  assert(hmenu != NULL);

  ctitems = GetMenuItemCount(hmenu);
  assert(ctitems >= FILE_MENU_ITEMS);

  id = 0;
  for (i = FILE_MENU_ITEMS + 1; i < ctitems; i++) {
    GetMenuString(hmenu, i, menuitem, sizeof(menuitem), MF_BYPOSITION);

    strcpy(cns_res.logins[id], menuitem + 3);

    id++;
  }
}
开发者ID:Akasurde,项目名称:krb5,代码行数:33,代码来源:cns.c


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


示例10: DlgProc

BOOL CALLBACK DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HMENU hMenu;
	switch (message)
	{
	case WM_CLOSE:
		DestroyWindow(hWnd);
		PostQuitMessage(0);
		return TRUE;

	case WM_INITDIALOG:
		hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MENU1));
		// Присоединим меню к главному окну приложения
		SetMenu(hWnd, hMenu);
		return TRUE;

	case WM_COMMAND:
	{
		TCHAR str1[300], str2[50];
		HMENU hMenu = GetMenu(hWnd);
		GetMenuString(hMenu, LOWORD(wParam), str2, 50, MF_BYCOMMAND);
		if (HIWORD(wParam) == 1)
			_tcscpy_s(str1,300, TEXT("Пункт меню выбран с помощью акселератора\n"));
		else if (HIWORD(wParam) == 0)
			_tcscpy_s(str1,300, TEXT("Пункт меню выбран при непосредственном обращении к меню\n"));
		_tcscat_s(str1,300, str2);
		MessageBox(hWnd, str1, TEXT("Меню и акселераторы"), MB_OK | MB_ICONINFORMATION);
	}
		return TRUE;
	}
	return FALSE;
}
开发者ID:CAHbl4,项目名称:WinAPI,代码行数:32,代码来源:Main.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: switch

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 通知消息
VOID CChildWnd::OnNotify(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch ((uMsg == WM_NOTIFY)	? ((LPNMHDR) lParam)->code : uMsg)
	{
	case TTN_NEEDTEXT:
		// 显示工具栏提示
		GetMenuString(CMainWnd::m_hMenu, (UINT) wParam, ((LPTOOLTIPTEXT) lParam)->szText, 80, MF_BYCOMMAND);

	case WM_MENUSELECT:
		// 在状态栏显示相应的菜单项提示
		CLanguage::TranslateString(LOWORD(wParam));
		if (CLanguage::m_tzText[0])
		{
			SetStatusText(hWnd, CLanguage::m_tzText);
			break;
		}

	case TTN_POP:
	case WM_EXITMENULOOP:
		// 在状态栏显示“就绪”
		SetStatusText(hWnd, LNG_Ready);
		break;

	case NM_CLICK:
		if (((LPNMHDR) lParam)->idFrom == IDC_StatusBar)
		{
			GetWnd(hWnd)->OnClickStatusBar((UINT) ((LPNMMOUSE) lParam)->dwItemSpec);
		}
		break;
	}
}
开发者ID:Yonsm,项目名称:RawPlayer,代码行数:33,代码来源:ChildWnd.cpp


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


示例14: oof

LRESULT CALLBACK oof(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	NMHDR *hdr = (NMHDR *)lParam;

	switch(msg)
	{
	case WM_COMMAND:
		switch(LOWORD(wParam))
		{
		case 6666:
			if(HIWORD(wParam) == CBN_EDITCHANGE)
			{
				TCHAR wstr[64];
				BYTE buf[64];
				int len;
				GetWindowText((HWND)lParam, wstr, 64);
				len = WideCharToMultiByte(CP_ACP, 0, wstr, -1, (char *)buf, 64, 0, 0);
				
				HexView_SetSearchPattern(g_hwndHexView, buf, len - 1);
				InvalidateRect(g_hwndHexView, 0, 0);
				return 0;
			}
			return 0;
		}
		return 0;

	case WM_NOTIFY:
		if(hdr->code == TBN_DROPDOWN)
		{
			RECT rect;
			HMENU hMenu;
			int cmd;
			TCHAR buf[20];
			TBBUTTONINFO tbbi = { sizeof(tbbi) };
			
			hMenu = LoadMenu(0, MAKEINTRESOURCE(IDR_SEARCHBAR_FINDTYPE));
			hMenu = GetSubMenu(hMenu, 0);
			SendMessage(hdr->hwndFrom, TB_GETITEMRECT, 0, (LPARAM)&rect);
			MapWindowPoints(hdr->hwndFrom, 0, (POINT *)&rect, 2);

			cmd = TrackPopupMenu(hMenu, TPM_LEFTALIGN|TPM_TOPALIGN|TPM_RETURNCMD|TPM_NONOTIFY, rect.left, rect.bottom, 0, hwnd, 0);

			if(cmd != 0)
			{
				GetMenuString(hMenu, cmd, buf, 20, MF_BYCOMMAND);
				tbbi.dwMask = TBIF_COMMAND|TBIF_TEXT;
				tbbi.idCommand = IDM_FILE_OPEN;
				tbbi.pszText   = buf;
				SendMessage(hdr->hwndFrom, TB_SETBUTTONINFO, IDM_FILE_OPEN, (LPARAM)&tbbi);
			}

			return TBDDRET_DEFAULT;
		}
		break;
	}
	
	return DefWindowProc(hwnd, msg, wParam, lParam);
}
开发者ID:HTshandou,项目名称:HexEdit,代码行数:58,代码来源:Searchbar.c


示例15: setupSystemMenu

static void setupSystemMenu( HWND hwnd ) {
    HMENU       smh;
    HMENU       mh;
    char        menuname[256];

    smh = GetSystemMenu( hwnd, FALSE );
    mh = GetMenu( hwnd );
    AppendMenu( smh, MF_SEPARATOR, 0,NULL );
    GetMenuString( mh, MENU_LOG_CURRENT_STATE, menuname, sizeof( menuname ),
                   MF_BYCOMMAND );
    AppendMenu( smh, MF_ENABLED, MENU_LOG_CURRENT_STATE, menuname );
    GetMenuString( mh, MENU_LOG_OPTIONS, menuname, sizeof( menuname ),
                   MF_BYCOMMAND );
    AppendMenu( smh, MF_ENABLED, MENU_LOG_OPTIONS, menuname );
    GetMenuString( mh, MENU_TASK_CTL, menuname, sizeof( menuname ),
                   MF_BYCOMMAND );
    AppendMenu( smh, MF_ENABLED, MENU_TASK_CTL, menuname );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:18,代码来源:drproc.c


示例16: GetMenuString

void CUserMeetingDlg::PutIntoPhone(HMENU hMenu, UINT nMenuId)
{
	CString strValue;
	GetMenuString( hMenu, nMenuId, strValue.GetBuffer(32), 32, MF_BYCOMMAND );
	strValue.ReleaseBuffer();
	
	int nPos = strValue.Find( '\t' );
	PutIntoPhone( nPos == -1 ? strValue : strValue.Mid( nPos + 1 ),
		nPos == -1 ? "" : strValue.Left( nPos ) );
}
开发者ID:pics860,项目名称:callcenter,代码行数:10,代码来源:DlgUserMeeting.cpp


示例17: GetMenuString

void CUIEditorView::OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu)
{
	CView::OnMenuSelect(nItemID, nFlags, hSysMenu);
	
	char szString[256] = {0};
	GetMenuString(hSysMenu, nItemID, szString, 255, 0);
	if(strlen(szString) > 0)
	{
		setWindowSelected((CEGUI::utf8*)szString,false);
	}
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:11,代码来源:UIEditorView.cpp


示例18: uikeyboard_menu_shortcuts

/* using MIIM_STRING doesn't work for win9x/winnt4, so trying an older way */
void uikeyboard_menu_shortcuts(HMENU menu)
{
    int i;
    int stringsize;
    LPTSTR  buf, newbuf;

    for (i = 0; idmlist[i].cmd > 0; i++) {
        if (menuitemmodifier[idmlist[i].cmd] != NULL) {
            stringsize = GetMenuString(menu, idmlist[i].cmd, NULL, 0, MF_BYCOMMAND);
            if (stringsize != 0) {
                stringsize++;
                buf = lib_malloc(stringsize);
                if (GetMenuString(menu, idmlist[i].cmd, buf, stringsize, MF_BYCOMMAND)) {
                    newbuf = util_concat(buf, menuitemmodifier[idmlist[i].cmd], NULL);
                    ModifyMenu(menu, idmlist[i].cmd, MF_BYCOMMAND | MF_STRING, idmlist[i].cmd, newbuf);
                    lib_free(newbuf);
                }
                lib_free(buf);
            }
        }
    }
}
开发者ID:AreaScout,项目名称:vice,代码行数:23,代码来源:uikeyboard.c


示例19: MenuWndProc

LRESULT CALLBACK
MenuWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    int id, cnt, mnu;
    PAINTSTRUCT ps;
    CHAR    szString[256], *pszString;
    HDC	hDC;
    RECT rc;
    POINT pt;
    HFONT hFont, hFontOld;
    HBRUSH hBrush, hBrushOld;
    LPMEASUREITEMSTRUCT lpMI = NULL;
    LPDRAWITEMSTRUCT lpDI = NULL;
    SIZE size;
    MENUITEMINFO mii = { sizeof(MENUITEMINFO),MIIM_CHECKMARKS|MIIM_TYPE|MIIM_SUBMENU };
    NONCLIENTMETRICS nm;
    HMENU hMenu, hMenuTop;
    BOOL isMenuBar;
    static BOOL bFirst = TRUE;

    if (pOldWndProc == NULL)
        return DefWindowProc(hWnd, uMsg, wParam, lParam);

    hMenu = GetMenu(hWnd);

    if (bFirst == TRUE)
    {
        SetOwnerDraw(hMenu, TRUE);
        bFirst = FALSE;
    }

    switch(uMsg)
    {
    case WM_INITMENUPOPUP:
        if (HIWORD(lParam) == 0)
            SetOwnerDraw((HMENU)wParam, TRUE);
        break;
    case WM_MEASUREITEM:
        lpMI = (LPMEASUREITEMSTRUCT)lParam;
        GetMenuItemInfo((HMENU)hMenu, lpMI->itemID, FALSE, &mii);
        GetMenuString(hMenu, lpMI->itemID, szString, sizeof(szString), MF_BYCOMMAND);
        if (strlen(szString) == 0 && lpMI->itemData)
            strcpy(szString, (char*)lpMI->itemData);

        if ((mii.fType & MF_SEPARATOR) != 0 ||
                ((mii.fType & MF_BITMAP) == 0 && strlen(szString) == 0))
        {
            lpMI->itemHeight = GetSystemMetrics(SM_CYMENU) >> 1;
            lpMI->itemWidth = 0;
        }
        else if (mii.fType & MF_BITMAP)
开发者ID:vim-scripts,项目名称:XpMenu,代码行数:51,代码来源:xpmenu.c


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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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