±â¼ú ÀÚ·á: 242577 - ¸¶Áö¸· °ËÅä: 2006³â 11¿ù 21ÀÏ È­¿äÀÏ - ¼öÁ¤: 5.1

Visual C++ ´ëÈ­ »óÀÚ¿¡ ÀÖ´Â ¸Þ´º ¿¬°áµÇ¾î ÀÖÀ¸¸é ÇØ´ç ¸í·É »ç¿ëÀÚ ÀÎÅÍÆäÀ̽º 󸮱Ⱑ ¸Þ´º Ç׸ñÀÇ »óŸ¦ º¯°æÇÒ ¼ö ¾ø½À´Ï´Ù.

½Ã½ºÅÛ ÆÁº» ¹®¼­ÀÇ ³»¿ëÀº ±ÍÇϰ¡ »ç¿ëÇÏ´Â ¿î¿µ üÁ¦¿Í ´Ù¸¥ ¿î¿µ üÁ¦¿¡ ÇØ´çÇÕ´Ï´Ù. ¹®¼­ ³»¿ë Áß ±ÍÇÏ¿Í °ü·Ã ¾ø´Â ºÎºÐÀº Ç¥½ÃµÇÁö ¾Ê½À´Ï´Ù.
Âü°í Microsoft Visual C++ .NET 2002 ¹× Microsoft Visual C++ .NET 2003 Microsoft .NET Framework¿¡¼­ Á¦°øÇÏ´Â °ü¸®µÇ´Â ÄÚµå ¸ðµ¨°ú °ü¸®µÇÁö ¾Ê´Â ³×ÀÌÆ¼ºê Microsoft Windows ÄÚµå ¸ðµ¨À» ¸ðµÎ Áö¿øÇÕ´Ï´Ù. ÀÌ ¹®¼­¿¡ ³ª¿Í ÀÖ´Â Á¤º¸´Â °ü¸®µÇÁö ¾Ê´Â Visual C++ Äڵ忡¸¸ Àû¿ëµË´Ï´Ù.Visual C++ 2005 Microsoft .NET Framework¿¡¼­ Á¦°øÇÏ´Â °ü¸®µÇ´Â ÄÚµå ¸ðµ¨°ú °ü¸®µÇÁö ¾Ê´Â ³×ÀÌÆ¼ºê Microsoft Windows ÄÚµå ¸ðµ¨À» ¸ðµÎ Áö¿øÇÕ´Ï´Ù.

ÀÌ ÆäÀÌÁö¿¡¼­

¸ðµÎ È®´ë | ¸ðµÎ Ãà¼Ò

Çö»ó

¸Þ´º ´ëÈ­ »óÀÚ°¡ ¿¬°áµÇ¾î ÀÖÀ¸¸é ÇØ´ç ¸í·É (UI (»ç¿ëÀÚ ÀÎÅÍÆäÀ̽º 󸮱Ⱑ ¸Þ´º Ç׸ñÀÇ »óÅ (»ç¿ë/»ç¿ë ¾È ÇÔ, È®ÀÎ/È®ÀÎ Ãë¼Ò¸¦, º¯°æ ÅØ½ºÆ®) º¯°æÇÏ´Â ±â´ÉÀÌ Á¦´ë·Î ÀÛµ¿ÇÏÁö ¾Ê½À´Ï´Ù:
void CTestDlg::OnUpdateFileExit(CCmdUI* pCmdUI) 
{
    pCmdUI->Enable(FALSE); //Not calling the command handler, but does not show as disabled.
    pCmdUI->SetCheck(TRUE); // Does not show check mark before the text.
    pCmdUI->SetRadio(TRUE); // Does not show dot before the text.
    pCmdUI->SetText("Close"); //Does not change the text.
}
				

¿øÀÎ

µå·Ó´Ù¿î ¸Þ´º°¡ Ç¥½ÃµÉ ¶§ ÇØ´ç WM_INITMENUPOPUP ¸Þ´º Ç׸ñÀ» Ç¥½ÃÇϱâ Àü¿¡ ¸Þ½ÃÁö°¡ º¸³»Áý´Ï´Ù. MFC CFrameWnd::OnInitMenuPopup ÇÔ¼ö¸¦ ÅëÇØ ¸Þ´º Ç׸ñÀ» ¹Ýº¹ÇÏ°í °æ¿ì Ç׸ñ¿¡ ´ëÇÑ ¾÷µ¥ÀÌÆ® ¸í·É UI 󸮱⸦ È£ÃâÇÕ´Ï´Ù. °¢ ¸Þ´º Ç׸ñÀÇ ¸ð¾çÀº (»ç¿ë/»ç¿ë ¾ÈÇÔ, üũ/unchecked) ±× »óŸ¦ ¹Ý¿µÇϵµ·Ï ¾÷µ¥ÀÌÆ®µË´Ï´Ù.

¾÷µ¥ÀÌÆ® UI ¸ÞÄ¿´ÏÁòÀÌ ÀÖ´Â ´ëÈ­ »óÀÚ ±â¹Ý ÀÀ¿ë ÇÁ·Î±×·¥À» À§ÇÑ CDialogOnInitMenuPopup 󸮱Ⱑ ÀÖÀ¸¹Ç·Î ¸í·É ¾÷µ¥ÀÌÆ® UI 󸮱⠸޴º Ç׸ñ¿¡ ´ëÇØ È£ÃâÇÒ CWnd ÀÇ ±âº» 󸮱⸦ »ç¿ëÇÏ´Â ÀÛµ¿ÇÏÁö ¾Ê½À´Ï´Ù.

ÇØ°á ¹æ¹ý

ÀÌ ¹®Á¦¸¦ ÇØ°áÇÏ·Á¸é ´ÙÀ½°ú °°ÀÌ ÇϽʽÿÀ.
  1. ¸Þ½ÃÁö ¸Ê¿¡ ON_WM_INITMENUPOPUP Ç׸ñÀ» Ãß°¡ÇÏ·Á¸é:
    BEGIN_MESSAGE_MAP(CTestDlg, CDialog)
    	//}}AFX_MSG_MAP
    
    	ON_WM_INITMENUPOPUP()
    END_MESSAGE_MAP()
    					
  2. ´ëÈ­ »óÀÚ Å¬·¡½º¿¡ OnInitMenuPopup ¸â¹ö ÇÔ¼ö¸¦ Ãß°¡ÇÏ°í ´ÙÀ½ Äڵ带 (ÀÌ ÄÚµå´Â ´ëºÎºÐ CFrameWnd::OnInitMenuPopup WinFrm.cpp¿¡¼­ °¡Á®¿Â °ÍÀÔ´Ï´Ù Âü°í) º¹»ç:
    void CTestDlg::OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu)
    {
        ASSERT(pPopupMenu != NULL);
        // Check the enabled state of various menu items.
    
        CCmdUI state;
        state.m_pMenu = pPopupMenu;
        ASSERT(state.m_pOther == NULL);
        ASSERT(state.m_pParentMenu == NULL);
    
        // Determine if menu is popup in top-level menu and set m_pOther to
        // it if so (m_pParentMenu == NULL indicates that it is secondary popup).
        HMENU hParentMenu;
        if (AfxGetThreadState()->m_hTrackingMenu == pPopupMenu->m_hMenu)
            state.m_pParentMenu = pPopupMenu;    // Parent == child for tracking popup.
        else if ((hParentMenu = ::GetMenu(m_hWnd)) != NULL)
        {
            CWnd* pParent = this;
               // Child windows don't have menus--need to go to the top!
            if (pParent != NULL &&
               (hParentMenu = ::GetMenu(pParent->m_hWnd)) != NULL)
            {
               int nIndexMax = ::GetMenuItemCount(hParentMenu);
               for (int nIndex = 0; nIndex < nIndexMax; nIndex++)
               {
                if (::GetSubMenu(hParentMenu, nIndex) == pPopupMenu->m_hMenu)
                {
                    // When popup is found, m_pParentMenu is containing menu.
                    state.m_pParentMenu = CMenu::FromHandle(hParentMenu);
                    break;
                }
               }
            }
        }
    
        state.m_nIndexMax = pPopupMenu->GetMenuItemCount();
        for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax;
          state.m_nIndex++)
        {
            state.m_nID = pPopupMenu->GetMenuItemID(state.m_nIndex);
            if (state.m_nID == 0)
               continue; // Menu separator or invalid cmd - ignore it.
    
            ASSERT(state.m_pOther == NULL);
            ASSERT(state.m_pMenu != NULL);
            if (state.m_nID == (UINT)-1)
            {
               // Possibly a popup menu, route to first item of that popup.
               state.m_pSubMenu = pPopupMenu->GetSubMenu(state.m_nIndex);
               if (state.m_pSubMenu == NULL ||
                (state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 ||
                state.m_nID == (UINT)-1)
               {
                continue;       // First item of popup can't be routed to.
               }
               state.DoUpdate(this, TRUE);   // Popups are never auto disabled.
            }
            else
            {
               // Normal menu item.
               // Auto enable/disable if frame window has m_bAutoMenuEnable
               // set and command is _not_ a system command.
               state.m_pSubMenu = NULL;
               state.DoUpdate(this, FALSE);
            }
    
            // Adjust for menu deletions and additions.
            UINT nCount = pPopupMenu->GetMenuItemCount();
            if (nCount < state.m_nIndexMax)
            {
               state.m_nIndex -= (state.m_nIndexMax - nCount);
               while (state.m_nIndex < nCount &&
                pPopupMenu->GetMenuItemID(state.m_nIndex) == state.m_nID)
               {
                state.m_nIndex++;
               }
            }
            state.m_nIndexMax = nCount;
        }
    }
    					

ÇöÀç »óÅÂ

À̰ÍÀº ÀǵµÀûÀ¸·Î ¼³°èµÈ µ¿ÀÛÀÔ´Ï´Ù.

Ãß°¡ Á¤º¸

¶ÇÇÑ ¸í·É ¾÷µ¥ÀÌÆ® UI 󸮱â ÀÖ´ÂÁö ¸í·ÉÀ» ¶ó¿ìÆÃÇϱâ Àü¿¡ »ç¿ëÇÒ µÉ ¼ö ¾øÀ½À» ¾ÊÀº CWnd::OnCommand È£ÃâµË´Ï´Ù. ȸ»öÀ¸·Î ³ªÅ¸³³´Ï´Ù °æ¿ì¿¡µµ ¸í·É 󸮱⸦ »ç¿ëÇÒ ¼ö ¾ø´Â ¸Þ´º Ç׸ñ¿¡ ´ëÇÑ (»ç¿ëÇÒ ¼ö ¾øÀ½) È£ÃâµÇÁö ¾ÊÀº ÀÌÀ¯°¡ ¹Ù·Î À̰ÍÀÔ´Ï´Ù. ÀÌ °æ¿ì ÇØ´ç »óŸ¦ ¹Ý¿µÇϵµ·Ï ¸Þ´º Ç׸ñÀº ±×¸®´ÂÁö ¾Ê½À´Ï´Ù. Wincore.cpp ÆÄÀÏ¿¡¼­ °ü·Ã ÄÚµåÀÔ´Ï´Ù:
   // Make sure command has not become disabled before routing.	
   CTestCmdUI state;
   state.m_nID = nID;
   OnCmdMsg(nID, CN_UPDATE_COMMAND_UI, &state, NULL);
   if (!state.m_bEnabled)
   {
      TRACE1("Warning: not executing disabled command %d\n", nID);
      return TRUE;
   }
				

Windows Mobile ±â¹Ý ½º¸¶Æ®Æù¿¡ GPRS ¿¬°áÀÌ ±¸¼ºµÇ¾î ÀÖ´ÂÁö È®ÀÎÇÕ´Ï´Ù

Visual C++ .NETÀÇ ÀÌ ¹®Á¦¸¦ ÀçÇöÇÏ·Á¸é ´ÙÀ½°ú °°ÀÌ ÇϽʽÿÀ.
  1. ÀÀ¿ë ÇÁ·Î±×·¥ ¸¶¹ý»ç ´ëÈ­ »óÀÚ ±â¹Ý MFC ÀÀ¿ë ÇÁ·Î±×·¥À» ¸¸µì´Ï´Ù.
  2. »õ ¸Þ´º ¸®¼Ò½º¸¦ ¸¸µé°í ÆÄÀÏ ¹× ÆÄÀÏ/³¡³»±â ¸Þ´º Ç׸ñÀ» Ãß°¡ÇϽʽÿÀ.
  3. ÀÌ ¸Þ´º ´ëÈ­ »óÀÚ´Â ¼Ó¼º â¿¡¼­ ´ëÈ­ »óÀÚ¿¡ ´ëÇÑ ¸Þ´º¸¦ ¼³Á¤ÇϽʽÿÀ. ÀÌ·¸°Ô ÇÏ·Á¸é ´ëÈ­ »óÀÚ ÆíÁý±â¿¡¼­ ´ëÈ­ »óÀÚ ¸®¼Ò½º¸¦ ¿±´Ï´Ù. ¼Ó¼º â¿¡¼­ ¸Þ´º Ŭ¸¯ÇÏ¿©°¡ ¼±ÅÃÇÕ´Ï´Ù. »õ ¸Þ´º ¸®¼Ò½º ID ¸Þ´º ¼Ó¼º ÆíÁý±â µå·Ó´Ù¿î ¸ñ·Ï¿¡ Ç¥½ÃµË´Ï´Ù.
  4. ÆÄÀÏ/³¡³»±â ¸Þ´º Ç׸ñ¿¡ ´ëÇÑ UPDATE_COMMAND_UI 󸮱⸦ Ãß°¡ÇϽʽÿÀ. ÀÌ·¸°Ô ÆÄÀÏ/³¡³»±â ¸Þ´º ÆíÁý±â¿¡¼­ ¸¶¿ì½º ¿À¸¥ÂÊ ´ÜÃ߷ΠŬ¸¯ÇÑ ´ÙÀ½ À̺¥Æ® 󸮱â Ãß°¡ ¼ö ÀÖ½À´Ï´Ù. À̺¥Æ® 󸮱⠸¶¹ý»ç¿¡¼­ UPDATE_COMMAND_UI 󸮱⸦ CDialog ÆÄ»ý Ŭ·¡½º¸¦ ÇÁ·ÎÁ§Æ®¿¡ Ãß°¡ÇϽʽÿÀ. ÇØ´ç 󸮱⸦ ¸¸µé·Á¸é Ãß°¡ ¹× ÆíÁý Ŭ¸¯ÇÑ ´ÙÀ½ ÀÌ·¯ÇÑ ¹® Áß Çϳª°¡ »ý¼ºµÈ 󸮱⠸޼­µå¸¦ Ãß°¡ÇÒ:
    	pCmdUI->Enable(FALSE); //Not calling the handler, but does not show as disabled
    	pCmdUI->SetCheck(TRUE); // Does not show check mark before the text.
    	pCmdUI->SetRadio(TRUE); // Does not show dot before the text.
    	pCmdUI->SetText("Close"); //Does not change the text.
    					
  5. ºôµå ¹× ÀÀ¿ë ÇÁ·Î±×·¥À» ½ÇÇàÇϽʽÿÀ.

ÂüÁ¶

Ãß°¡ Á¤º¸´Â ´ÙÀ½ ¹®¼­ ¹øÈ£¸¦ Ŭ¸¯ÇÏ¿© Microsoft ±â¼ú ÀÚ·á¿¡¼­ È®ÀÎÇϽʽÿÀ:
141751? (http://support.microsoft.com/kb/141751/ ) MFC ´ëÈ­ »óÀÚ¿¡ ÄÁÆ®·Ñ ¸·´ë Ãß°¡

º» ¹®¼­ÀÇ Á¤º¸´Â ´ÙÀ½ÀÇ Á¦Ç°¿¡ Àû¿ëµË´Ï´Ù.
  • Microsoft Foundation Class Library 4.2?À»(¸¦) ´ÙÀ½°ú ÇÔ²² »ç¿ëÇßÀ» ¶§
    • Microsoft Visual C++ 6.0 Enterprise Edition
    • Microsoft Visual C++ 6.0 Professional Edition
    • Microsoft Visual C++, 32-bit Learning Edition 6.0
    • Microsoft Visual C++ 2005 Express Edition
    • Microsoft Visual C++ .NET 2003 Standard Edition
    • Microsoft Visual C++ .NET 2002 Standard Edition
Ű¿öµå:?
kbmt kbtshoot kbdlg kbmenu kbprb kbuidesign KB242577 KbMtko
±â°è ¹ø¿ªµÈ ¹®¼­±â°è ¹ø¿ªµÈ ¹®¼­
Áß¿ä: º» ¹®¼­´Â Àü¹® ¹ø¿ª°¡°¡ ¹ø¿ªÇÑ °ÍÀÌ ¾Æ´Ï¶ó Microsoft ±â°è ¹ø¿ª ¼ÒÇÁÆ®¿þ¾î·Î ¹ø¿ªÇÑ °ÍÀÔ´Ï´Ù. Microsoft´Â ¹ø¿ª°¡°¡ ¹ø¿ªÇÑ ¹®¼­ ¹× ±â°è ¹ø¿ªµÈ ¹®¼­¸¦ ¸ðµÎ Á¦°øÇϹǷΠMicrosoft ±â¼ú ÀÚ·á¿¡ ÀÖ´Â ¸ðµç ¹®¼­¸¦ Çѱ۷ΠÁ¢ÇÒ ¼ö ÀÖ½À´Ï´Ù. ±×·¯³ª ±â°è ¹ø¿ª ¹®¼­°¡ Ç×»ó ¿Ïº®ÇÑ °ÍÀº ¾Æ´Õ´Ï´Ù. µû¶ó¼­ ±â°è ¹ø¿ª ¹®¼­¿¡´Â ¸¶Ä¡ ¿Ü±¹ÀÎÀÌ Çѱ¹¾î·Î ¸»ÇÒ ¶§ ½Ç¼ö¸¦ ÇÏ´Â °Íó·³ ¾îÈÖ, ±¸¹® ¶Ç´Â ¹®¹ý¿¡ ¿À·ù°¡ ÀÖÀ» ¼ö ÀÖ½À´Ï´Ù. Microsoft´Â ³»¿ë»óÀÇ ¿À¿ª ¶Ç´Â Microsoft °í°´ÀÌ ÀÌ·¯ÇÑ ¿À¿ªÀ» »ç¿ëÇÔÀ¸·Î½á ¹ß»ýÇÏ´Â ºÎ Á¤È®¼º, ¿À·ù ¶Ç´Â ¼ÕÇØ¿¡ ´ëÇØ Ã¥ÀÓÀ» ÁöÁö ¾Ê½À´Ï´Ù. Microsoft´Â ÀÌ·¯ÇÑ ¹®Á¦¸¦ ÇØ°áÇϱâ À§ÇØ ±â°è ¹ø¿ª ¼ÒÇÁÆ®¿þ¾î¸¦ ÀÚÁÖ ¾÷µ¥ÀÌÆ®Çϰí ÀÖ½À´Ï´Ù.