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


C++ GetMenuState函数代码示例

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


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


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