这篇教程C++ GetMenuString函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetMenuString函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMenuString函数的具体用法?C++ GetMenuString怎么用?C++ GetMenuString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetMenuString函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mh_getLabelstatic 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,
示例2: 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,
示例3: GetMenuItemCountvoid 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,
示例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,
示例5: GetCodeTitlevoid 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,
示例6: 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,
示例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,
示例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 voidkwin_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,
示例9: FindSortedPos// find sorted position after the last separatorint 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,
示例10: DlgProcBOOL 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,
示例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: 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,
示例13: 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,
示例14: oofLRESULT 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,
示例15: setupSystemMenustatic 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,
示例16: GetMenuStringvoid 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,
示例17: GetMenuStringvoid 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,
示例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,
示例19: MenuWndProcLRESULT CALLBACKMenuWndProc(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,
示例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,
示例21: InitTrayCBWndvoid InitTrayCBWnd(BOOL bCreate){ LONG i, lMMItemCnt, lTMItemCnt; if (bCreate) { WCHAR lpwText[MAX_PATH] = { 0 }; hTrayMenu = CreatePopupMenu(); AppendMenu(hTrayMenu, MF_STRING, IDM_TRAY_HIDESHOW, L"&Hide/Show Player"); AppendMenu(hTrayMenu, MF_SEPARATOR, 0, 0); lMMItemCnt = GetMenuItemCount(GetMenu(hMainWnd)); for (i = 0; i < lMMItemCnt; i++) { GetMenuString(GetMenu(hMainWnd), i, lpwText, MAX_PATH, MF_BYPOSITION); AppendMenu(hTrayMenu, MF_STRING | MF_POPUP, (UINT_PTR)GetSubMenu(GetMenu(hMainWnd), i), lpwText); } SetMenuDefaultItem(hTrayMenu, IDM_TRAY_HIDESHOW, FALSE); WCEX.cbSize = sizeof(WNDCLASSEX); WCEX.lpfnWndProc = (WNDPROC)TrayCBWndProc; WCEX.hInstance = hAppInstance; WCEX.hbrBackground = GetSysColorBrush(COLOR_3DFACE); WCEX.lpszClassName = TRAY_CB_WND_CLASS; RegisterClassEx(&WCEX); hTrayCBWnd = CreateWindow(WCEX.lpszClassName, 0, WS_POPUP, 16, 16, 32, 32, 0, hTrayMenu, hAppInstance, 0); if (!dwNoOwnerDrawMenu) { pEBMenuTray->hBmpCheck = (HBITMAP)LoadImage(hAppInstance, MAKEINTRESOURCE(IDB_CHECKMARK), IMAGE_BITMAP, 16, 16, 0); pEBMenuTray->hBmpRadioCheck = (HBITMAP)LoadImage(hAppInstance, MAKEINTRESOURCE(IDB_RADIOCHECKMARK), IMAGE_BITMAP, 16, 16, 0); pEBMenuTray->InitEBMenu(hTrayCBWnd, TRUE); } } else { if (!dwNoOwnerDrawMenu) pEBMenuTray->InitEBMenu(0); lMMItemCnt = GetMenuItemCount(GetMenu(hMainWnd)); lTMItemCnt = GetMenuItemCount(hTrayMenu); for (i = (lTMItemCnt - 1); i >= (lTMItemCnt - lMMItemCnt); i--) { RemoveMenu(hTrayMenu, i, MF_BYPOSITION); } DestroyMenu(hTrayMenu); hTrayMenu = 0; DestroyWindow(hTrayCBWnd); hTrayCBWnd = 0; }}
开发者ID:BorisVorontsov,项目名称:easybar,代码行数:49,
示例22: SetOwnerDrawvoid SetOwnerDraw(HMENU hMenu, BOOL bMode){ int id, mnu; MENUITEMINFO mii = { sizeof(MENUITEMINFO),MIIM_CHECKMARKS|MIIM_TYPE|MIIM_DATA }; CHAR szString[256]; HMENU hSubMenu; if (hMenu == NULL) return; for(mnu = 0; mnu < GetMenuItemCount(hMenu); mnu++) { GetMenuItemInfo((HMENU)hMenu, mnu, TRUE, &mii); if (bMode) { mii.fType |= MFT_OWNERDRAW; if (mii.hSubMenu == NULL && (mii.fType & MF_SEPARATOR) == 0 && mii.dwItemData == 0) { LPSTR pCopy; GetMenuString(hMenu, mnu, szString, sizeof(szString), MF_BYPOSITION); pCopy = strdup(szString); if (pCopy) { mii.fMask |= MIIM_DATA; mii.dwItemData = (DWORD)pCopy; } } } else { mii.fType &= ~MFT_OWNERDRAW; if (mii.hSubMenu == NULL && (mii.fType & MF_SEPARATOR) == 0) { mii.fMask &= ~MIIM_DATA; if (mii.dwItemData) { free((LPSTR)mii.dwItemData); mii.dwItemData = 0; } } } SetMenuItemInfo(hMenu, mnu, TRUE, &mii); hSubMenu = GetSubMenu(hMenu, mnu); if (hSubMenu) SetOwnerDraw(hSubMenu, bMode); }}
开发者ID:vim-scripts,项目名称:XpMenu,代码行数:49,
示例23: 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,
示例24: FSimWindowProcLRESULT CALLBACK FSimWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_NCPAINT: { // add a menu to the fs window HMENU hFSMenu; hFSMenu = GetMenu(hwnd); if( hFSMenu!=NULL ) { int i; // Look for our menu entry in the main menu. for( i=0; i<GetMenuItemCount(hFSMenu); i++ ) { char buf[128]; GetMenuString( hFSMenu, i, buf, 128, MF_BYPOSITION ); if( strcmp(buf, MENU_ENTRY)==0 ) { // It is already here, we do not need to add it again break; } } if( i<GetMenuItemCount(hFSMenu) ) { // It is already here, we do not need to add it again break; } /* Create new menu. NOTE: It seems that this will be * reached more times, so we cannot save the handle, because * in such case it could be destroyed and we will not have * any access to it in the simulator. */ // add the created menu to the main menu AppendMenu(hFSMenu, MF_STRING | MF_POPUP, (UINT_PTR)uiThread->ui->newMenu(), MENU_ENTRY); } }break; case WM_COMMAND: { if( LOWORD(wParam)>=ID_FIRST && LOWORD(wParam)<=ID_LAST ) uiThread->postThreadMessage( uMsg, wParam, lParam ); else switch( LOWORD(wParam) ) { case ID_ASYNC: uiThread->ui->async(); //dout << "async" << std::endl; break; } } break; } // Call the original window procedure to handle all other messages return CallWindowProc(oldWndProc, hwnd, uMsg, wParam, lParam);}
开发者ID:BackupTheBerlios,项目名称:multicrew-svn,代码行数:49,
示例25: GetMenuItemIndex// returns -1 if not foundint GetMenuItemIndex(HMENU hMenu, const char* ItemName){ int index = 0; char buf[256]; while(index < GetMenuItemCount(hMenu)) { if(GetMenuString(hMenu, index, buf, sizeof(buf)-1, MF_BYPOSITION)) { if(!strcmp(ItemName, buf)) return index; } index++; } return -1;}
开发者ID:SyrianBallaS,项目名称:RASuite,代码行数:17,
注:本文中的GetMenuString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetMesh函数代码示例 C++ GetMenuState函数代码示例 |