Click here to Skip to main content
15,921,542 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Disable a Button ina SDI application Pin
Nishad S7-Nov-08 2:53
Nishad S7-Nov-08 2:53 
AnswerRe: Disable a Button ina SDI application Pin
Saurabh.Garg7-Nov-08 2:55
Saurabh.Garg7-Nov-08 2:55 
AnswerRe: Disable a Button ina SDI application Pin
Hamid_RT7-Nov-08 20:26
Hamid_RT7-Nov-08 20:26 
QuestionHow to get a string according to a "language identifier"? [modified] Pin
Joseph Marzbani7-Nov-08 1:08
Joseph Marzbani7-Nov-08 1:08 
AnswerRe: How to get a string according to a "language identifier"? Pin
CPallini7-Nov-08 1:54
mveCPallini7-Nov-08 1:54 
GeneralRe: How to get a string according to a "language identifier"? Pin
Joseph Marzbani7-Nov-08 4:19
Joseph Marzbani7-Nov-08 4:19 
Questionhow to show enable/disable check mark for menu items in a dialog based application? Pin
puppya7-Nov-08 0:51
puppya7-Nov-08 0:51 
AnswerRe: how to show enable/disable check mark for menu items in a dialog based application? Pin
Saurabh.Garg7-Nov-08 3:01
Saurabh.Garg7-Nov-08 3:01 
Add the handler for WM_INITMENUPOPUP in your dialog class and copy the following code in that function.

CWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);

ASSERT(pPopupMenu != NULL);
CCmdUI state; // Check the enabled state of various menu items
state.m_pMenu = pPopupMenu;
ASSERT(state.m_pOther == NULL);
ASSERT(state.m_pParentMenu == NULL);

// Is the menu in question a popup in the top-level menu? If so, set m_pOther
// to this menu. Note that m_pParentMenu == NULL indicates that the menu is a
// 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;
}


-Saurabh
AnswerRe: how to show enable/disable check mark for menu items in a dialog based application? Pin
Mark Salsbery7-Nov-08 3:11
Mark Salsbery7-Nov-08 3:11 
GeneralRe: how to show enable/disable check mark for menu items in a dialog based application? Pin
Nishad S7-Nov-08 3:21
Nishad S7-Nov-08 3:21 
GeneralRe: how to show enable/disable check mark for menu items in a dialog based application? Pin
Mark Salsbery7-Nov-08 3:29
Mark Salsbery7-Nov-08 3:29 
GeneralRe: how to show enable/disable check mark for menu items in a dialog based application? Pin
Nishad S7-Nov-08 3:35
Nishad S7-Nov-08 3:35 
QuestionHow can i pop up a new view in a SDI application Pin
m_mun7-Nov-08 0:20
m_mun7-Nov-08 0:20 
QuestionINTERNAL COMPILER ERROR Pin
Shino C G7-Nov-08 0:14
Shino C G7-Nov-08 0:14 
QuestionRe: INTERNAL COMPILER ERROR Pin
David Crow7-Nov-08 2:42
David Crow7-Nov-08 2:42 
AnswerRe: INTERNAL COMPILER ERROR Pin
Shino C G7-Nov-08 3:16
Shino C G7-Nov-08 3:16 
QuestionRe: INTERNAL COMPILER ERROR Pin
David Crow7-Nov-08 3:20
David Crow7-Nov-08 3:20 
AnswerRe: INTERNAL COMPILER ERROR Pin
Jijo.Raj7-Nov-08 6:18
Jijo.Raj7-Nov-08 6:18 
Questionconvert image bitmap 8bits ??? wish help me Pin
aa_zz6-Nov-08 23:06
aa_zz6-Nov-08 23:06 
AnswerRe: convert image bitmap 8bits ??? wish help me Pin
Saurabh.Garg7-Nov-08 3:03
Saurabh.Garg7-Nov-08 3:03 
GeneralRe: convert image bitmap 8bits ??? wish help me Pin
Nishad S7-Nov-08 3:19
Nishad S7-Nov-08 3:19 
GeneralRe: convert image bitmap 8bits ??? wish help me Pin
Saurabh.Garg7-Nov-08 4:26
Saurabh.Garg7-Nov-08 4:26 
GeneralRe: convert image bitmap 8bits ??? wish help me Pin
Nishad S7-Nov-08 23:06
Nishad S7-Nov-08 23:06 
GeneralRe: convert image bitmap 8bits ??? wish help me Pin
aa_zz9-Nov-08 15:37
aa_zz9-Nov-08 15:37 
GeneralRe: convert image bitmap 8bits ??? wish help me Pin
aa_zz9-Nov-08 19:48
aa_zz9-Nov-08 19:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.