menu change runtime

Helo everybody!
I'm writing to ask you some advices....
I'm programming in Visual C++ (ver. 6.0), MFC; in my application, I'm modifying the menu of the main frame window in runtime, such as:
CMainFrame* pMainFrame = (CMainFrame*)AfxGetApp()->GetMainWnd();
CMenu* pMenu = pMainFrame->GetMenu();

// modifications, like pMenu->GetSubMenu(2)->AppendMenu(MF_STRING|MF_ENABLED, ID_DISPLAY_IMAGE, nome);

pMainFrame->SetMenu( pMenu );
pMainFrame->DrawMenuBar();

My problem is that when I open several documents (2 or more), and I change the focus of a child window (i.e. I click on a lower child wnd to let it be close up), the menu change its appearance in the basic appearance (loaded during the initialization of the application); more exactly, I write in the sub menu the name of the open images and the menu shows, after the change of focus, a list of Image#1, Image#2, ... which is the basic form of the sub menu itself.

Any idea how to fix it??

Thank you all for your help!!
Please!!
Need help!!!!!!!!


Hello everybody!
I'm writing to ask you some advices....
I'm programming in Visual C++ (ver. 6.0), MFC; in my application, I'm modifying the menu of the main frame window in runtime, such as:
CMainFrame* pMainFrame = (CMainFrame*)AfxGetApp()->GetMainWnd();
CMenu* pMenu = pMainFrame->GetMenu();

// modifications, like pMenu->GetSubMenu(2)->AppendMenu(MF_STRING|MF_ENABLED, ID_DISPLAY_IMAGE, nome);

pMainFrame->SetMenu( pMenu );
pMainFrame->DrawMenuBar();

My problem is that when I open several documents (2 or more), and I change the focus of a child window (i.e. I click on a lower child wnd to let it be close up), the menu change its appearance in the basic appearance (loaded during the initialization of the application); more exactly, I write in the sub menu the name of the open images and the menu shows, after the change of focus, a list of Image#1, Image#2, ... which is the basic form of the sub menu itself.

Any idea how to fix it??

Thank you all for your help!!

Yes, very nice. Beg for help on the wrong board and, while you're at it, double-post the exact same post. That's bound to give you helpful replies such as this.
Topic archived. No new replies allowed.