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

C++ GetMenuState函数代码示例

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

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



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

示例1: FitToScreen

short FitToScreen(HWND hWnd, BRDATA lpBrData)
{
    HMENU hMenu;
    WORD wRes;

    hMenu = GetMenu(hWnd);
    wRes = GetMenuState(hMenu, IDM_FIT, MF_BYCOMMAND);

    /* If item currently checked, uncheck it. Otherwise check it */
    if (wRes & MF_CHECKED)
        UpdateFitMenu(hWnd, lpBrData, FALSE);
    else
        UpdateFitMenu(hWnd, lpBrData, TRUE);

    /* Fix up the scroll bars */
    if (lpBrData->bFitToScreen)
    {
        SetScrollPos(hWnd, SB_VERT, MINPOS, TRUE);
        SetScrollPos(hWnd, SB_HORZ, MINPOS, TRUE);
    }
    else
    {
        SetScrollPos(hWnd, SB_VERT, lpBrData->vThumb, TRUE);
        SetScrollPos(hWnd, SB_HORZ, lpBrData->hThumb, TRUE);
    }

    /* Cause a repaint */
    UPDATE_SCREEN(hWnd);

    return TRUE;
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:31,代码来源:BROWSER.C


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


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


示例6: IEIsMenuIDValid

/*
 * IEIsMenuIDValid
 */
static BOOL IEIsMenuIDValid( HMENU menu, unsigned id )
{
    UINT st;

    if( !ImgEdEnableMenuInput ) {
        return( FALSE );
    }

    if( menu == (HMENU)NULL ) {
        return( TRUE );
    }

    // put any menu identifiers that you would like forced here
    switch( id ) {
    case IMGED_CLOSEALL:
        if( ImgedIsDDE ) {
            return( TRUE );
        }
        break;
    }

    st = GetMenuState( menu, id, MF_BYCOMMAND );

    if( st == -1 || (st & MF_GRAYED) == MF_GRAYED ) {
        return( FALSE );
    }

    return( TRUE );

} /* IEIsMenuIDValid */
开发者ID:lycaner,项目名称:open-watcom-v2,代码行数:33,代码来源:ieproc.c


示例7: DefWndNCLButtonDblClk

LRESULT
DefWndNCLButtonDblClk(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
  ULONG Style;

  Style = GetWindowLongPtrW(hWnd, GWL_STYLE);
  switch(wParam)
  {
    case HTCAPTION:
    {
      /* Maximize/Restore the window */
      if((Style & WS_CAPTION) == WS_CAPTION && (Style & WS_MAXIMIZEBOX))
      {
        SendMessageW(hWnd, WM_SYSCOMMAND, ((Style & (WS_MINIMIZE | WS_MAXIMIZE)) ? SC_RESTORE : SC_MAXIMIZE), 0);
      }
      break;
    }
    case HTSYSMENU:
    {
      HMENU hSysMenu = GetSystemMenu(hWnd, FALSE);
      UINT state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
                  
      /* If the close item of the sysmenu is disabled or not present do nothing */
      if ((state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF))
          break;

      SendMessageW(hWnd, WM_SYSCOMMAND, SC_CLOSE, lParam);
      break;
    }
    default:
      return DefWndNCLButtonDown(hWnd, wParam, lParam);
  }
  return(0);
}
开发者ID:RPG-7,项目名称:reactos,代码行数:34,代码来源:nonclient.c


示例8: TaskManager_OnOptionsShow16BitTasks

void TaskManager_OnOptionsShow16BitTasks(void)
{
    HMENU    hMenu;
    HMENU    hOptionsMenu;

    hMenu = GetMenu(hMainWnd);
    hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);

    /*
     * FIXME: Currently this is useless because the
     * current implementation doesn't list the 16-bit
     * processes. I believe that would require querying
     * each ntvdm.exe process for it's children.
     */

    /*
     * Check or uncheck the show 16-bit tasks menu item
     */
    if (GetMenuState(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND) & MF_CHECKED)
    {
        CheckMenuItem(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_UNCHECKED);
        TaskManagerSettings.Show16BitTasks = FALSE;
    }
    else
    {
        CheckMenuItem(hOptionsMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_CHECKED);
        TaskManagerSettings.Show16BitTasks = TRUE;
    }

    /*
     * Refresh the list of processes.
     */
    RefreshProcessPage();
}
开发者ID:Sunmonds,项目名称:wine,代码行数:34,代码来源:optnmenu.c


示例9: winItemGetValueAttrib

static char* winItemGetValueAttrib(Ihandle* ih)
{
  if (GetMenuState((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND) & MF_CHECKED)
    return "ON";
  else
    return "OFF";
}
开发者ID:Archs,项目名称:iup-aio,代码行数:7,代码来源:iupwin_menu.c


示例10: winItemGetActiveAttrib

static char* winItemGetActiveAttrib(Ihandle* ih)
{
  if (ih->handle == (InativeHandle*)-1) /* check if submenu is actually created */
    return NULL;

  return iupStrReturnBoolean(!(GetMenuState((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND) & MF_GRAYED));
}
开发者ID:ivanceras,项目名称:iup-mirror,代码行数:7,代码来源:iupwin_menu.c


示例11: winItemGetActiveAttrib

static char* winItemGetActiveAttrib(Ihandle* ih)
{
  /* check if the submenu handle was created in winSubmenuAddToParent */
  if (ih->handle == (InativeHandle*)-1)
    return NULL;

  return iupStrReturnBoolean(!(GetMenuState((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND) & MF_GRAYED));
}
开发者ID:mwoz,项目名称:Hildim.Source,代码行数:8,代码来源:iupwin_menu.c


示例12: GetMenuState

void Accelerator::updateMenuItemByCommand(CommandShortcut csc) {
	int cmdID = (int)csc.getID();
	
	//  Ensure that the menu item checks set prior to this update remain in affect.
	UINT cmdFlags = GetMenuState(_hAccelMenu, cmdID, MF_BYCOMMAND );
	cmdFlags = MF_BYCOMMAND | (cmdFlags&MF_CHECKED) ? ( MF_CHECKED ) : ( MF_UNCHECKED );
	::ModifyMenu(_hAccelMenu, cmdID, cmdFlags, cmdID, csc.toMenuItemString().c_str());
}
开发者ID:Tanjas5,项目名称:npp,代码行数:8,代码来源:shortcut.cpp


示例13: IsMenuNonEmpty

bool IsMenuNonEmpty(HMENU menu) {
	unsigned n,m=GetMenuItemCount(menu);
	for(n=0;n<m;n++) {
		if (GetSubMenu(menu,n)) return true;
		if (!(GetMenuState(menu,n,MF_BYPOSITION)&MF_SEPARATOR)) return true;
	}
	return false;
}
开发者ID:Annovae,项目名称:desmume,代码行数:8,代码来源:win32_misc.cpp


示例14: menu_check_autorun

void menu_check_autorun()
{
	UINT state = GetMenuState(menu_tray, IDM_AUTORUN, MF_BYCOMMAND);
	bool to_check = !(state & MF_CHECKED); // revert

	menu_check(IDM_AUTORUN, to_check);

	if (to_check) { autorun_enable(); }
	else { autorun_cancel(); }
}
开发者ID:sprinfall,项目名称:windows-workspace,代码行数:10,代码来源:menu.cpp


示例15: winItemGetActiveAttrib

static char* winItemGetActiveAttrib(Ihandle* ih)
{
  if (ih->handle == (InativeHandle*)-1) /* check if submenu is actually created */
    return NULL;

  if (GetMenuState((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND) & MF_GRAYED)
    return "NO";
  else
    return "YES";
}
开发者ID:Archs,项目名称:iup-aio,代码行数:10,代码来源:iupwin_menu.c


示例16: GetMenuState

void Menuer::checkAutorunMenu()
{
    UINT state = GetMenuState(trayMenu_, IDM_AUTORUN, MF_BYCOMMAND);
    bool toCheck = !(state & MF_CHECKED); // revert

    checkMenu(IDM_AUTORUN, toCheck);

    if (toCheck) { autorun_enable(); }
    else { autorun_cancel(); }
}
开发者ID:sprinfall,项目名称:windows-workspace,代码行数:10,代码来源:menuer.cpp


示例17: get_menu

int get_menu(HMENU hMenu, int ctrlID)
{
	if (GetMenuState(hMenu,ctrlID,MF_BYCOMMAND)&MF_CHECKED) {
		CheckMenuItem(hMenu,ctrlID,MF_UNCHECKED|MF_BYCOMMAND);
		return 0;
	}
	else {
		CheckMenuItem(hMenu,ctrlID,MF_CHECKED|MF_BYCOMMAND);
		return 1;
	}
}
开发者ID:aquabluefish,项目名称:serialprobe,代码行数:11,代码来源:skel.cpp


示例18: GetLyricStatus

BOOL GetLyricStatus()
{
	HMENU menu = GetMenu(main_wnd.hWnd);
	if (menu != NULL)
	{
		if (GetMenuState(menu, IDM_MENU_LYRIC_STATUS, MF_BYCOMMAND | MF_CHECKED) > 0)
			return TRUE;
	}

	return FALSE;
}
开发者ID:hihua,项目名称:hihuacode,代码行数:11,代码来源:AudioPlayer.cpp


示例19: WndProc

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, 
    WPARAM wParam, LPARAM lParam) {
    
    UINT state;

    switch(msg) {
    
      case WM_CREATE:
      
          AddMenus(hwnd);          
          InitCommonControls();

          ghSb = CreateWindowExW(0, STATUSCLASSNAMEW, NULL, 
              WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwnd, 
              (HMENU) 1, GetModuleHandle(NULL), NULL);

          break;

      case WM_COMMAND:
          
          switch(LOWORD(wParam)) {
          
              case IDM_VIEW_STB:                                    
                  
                  state = GetMenuState(ghMenu, IDM_VIEW_STB, MF_BYCOMMAND); 

                  if (state == MF_CHECKED) {
                  
                      ShowWindow(ghSb, SW_HIDE);
                      CheckMenuItem(ghMenu, IDM_VIEW_STB, MF_UNCHECKED);  
                  } else {
                  
                      ShowWindow(ghSb, SW_SHOWNA);
                      CheckMenuItem(ghMenu, IDM_VIEW_STB, MF_CHECKED);  
                  }
                  
                  break;
          }
          
          break;

      case WM_SIZE:
      
          SendMessage(ghSb, WM_SIZE, wParam, lParam);          
          break;

      case WM_DESTROY:
      
          PostQuitMessage(0);
          break;
    }

    return DefWindowProcW(hwnd, msg, wParam, lParam);
}
开发者ID:janbodnar,项目名称:Windows-API-examples,代码行数:54,代码来源:checkmenuitem.c


示例20: hugsprim_GetMenuState_10

static void hugsprim_GetMenuState_10(HugsStackPtr hugs_root)
{
    HsPtr arg1;
    HsWord32 arg2;
    HsWord32 arg3;
    HsWord32 res1;
    arg1 = hugs->getPtr();
    arg2 = hugs->getWord32();
    arg3 = hugs->getWord32();
    res1 = GetMenuState(arg1, arg2, arg3);
    hugs->putWord32(res1);
    hugs->returnIO(hugs_root,1);
}
开发者ID:xpika,项目名称:winhugs,代码行数:13,代码来源:Menu.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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