Click here to Skip to main content
15,121,030 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
SuggestionRe: doubt in typdef segregation one class in two Pin
Jochen Arndt12-Jan-16 21:53
professionalJochen Arndt12-Jan-16 21:53 
QuestionVisual Studio 2016 & MFC Pin
BarryPearlman11-Jan-16 17:54
MemberBarryPearlman11-Jan-16 17:54 
AnswerRe: Visual Studio 2016 & MFC Pin
Jochen Arndt11-Jan-16 21:52
professionalJochen Arndt11-Jan-16 21:52 
QuestionMFC, Cannot disable Menu option from Child View Pin
Member 1120327711-Jan-16 5:30
MemberMember 1120327711-Jan-16 5:30 
AnswerRe: MFC, Cannot disable Menu option from Child View Pin
Richard MacCutchan11-Jan-16 6:59
mveRichard MacCutchan11-Jan-16 6:59 
GeneralRe: MFC, Cannot disable Menu option from Child View Pin
Member 1120327711-Jan-16 8:23
MemberMember 1120327711-Jan-16 8:23 
GeneralRe: MFC, Cannot disable Menu option from Child View Pin
Richard MacCutchan11-Jan-16 22:23
mveRichard MacCutchan11-Jan-16 22:23 
AnswerRe: MFC, Cannot disable Menu option from Child View Pin
Jochen Arndt11-Jan-16 22:30
professionalJochen Arndt11-Jan-16 22:30 
Member 11203277 wrote:
In the child window i can successfully do a MouseRight click and popup of some menu with its submenus from the main menu bar.

So you are using a popup (context) menu here and not the menu of the main frame (only the menu items / resources are re-used).

Then you should handle enabling/disabling when opening the popup menu and pass AfxGetMainWnd() as the owner window (see code comments):
CMenu *pMenu = new CMenu;
pMenu->LoadMenu(IDR_OF_MENU);
// Get the pop-up menu.
CMenu *pPopupMenu = pMenu->GetSubMenu(0);
// Enable disable an item by ID.
pPopupMenu->EnableMenuItem(CM_VIEW_OPTION1, CMViewOption1Enabled ? 0 : MF_GRAYED);
// Show context menu and wait for selection.
// Advantages of passing AfxGetMainWnd():
//  - Calls provided OnUpdate() functions to determine state of items.
//    NOTE: Items can be only disabled using the OnUpdate handlers!
//    So there must be handlers for those items that may be disabled!
//    If no update handlers are present, items are enabled by default
//     (by existance of command handlers).
//  - Shows short info about items in status bar
//  - Processes F1 help
pPopupMenu->TrackPopupMenuEx(flags, x, y, AfxGetMainWnd(), NULL);
delete pMenu;

A dynamic update is not necessary here when the popup menu closes with the first click. Otherwise make pPopupMenu a member of your child view so that it can be used to change items and/or their state dynamically.
GeneralRe: MFC, Cannot disable Menu option from Child View Pin
Member 1120327712-Jan-16 4:51
MemberMember 1120327712-Jan-16 4:51 
QuestionHow to change a alignment of CStatic Label at run time? Pin
Le@rner9-Jan-16 2:52
MemberLe@rner9-Jan-16 2:52 
AnswerRe: How to change a alignment of CStatic Label at run time? Pin
Richard MacCutchan9-Jan-16 3:46
mveRichard MacCutchan9-Jan-16 3:46 
GeneralRe: How to change a alignment of CStatic Label at run time? Pin
Le@rner10-Jan-16 19:29
MemberLe@rner10-Jan-16 19:29 
QuestionRe: How to change a alignment of CStatic Label at run time? Pin
Richard MacCutchan10-Jan-16 21:56
mveRichard MacCutchan10-Jan-16 21:56 
AnswerRe: How to change a alignment of CStatic Label at run time? Pin
Le@rner12-Jan-16 19:23
MemberLe@rner12-Jan-16 19:23 
GeneralRe: How to change a alignment of CStatic Label at run time? Pin
Richard MacCutchan12-Jan-16 22:20
mveRichard MacCutchan12-Jan-16 22:20 
QuestionHow to determine whether the disk is bitlocker? Pin
AnsiliWork8-Jan-16 20:29
MemberAnsiliWork8-Jan-16 20:29 
AnswerRe: How to determine whether the disk is bitlocker? Pin
Richard MacCutchan8-Jan-16 23:51
mveRichard MacCutchan8-Jan-16 23:51 
QuestionObject Data lost when dialog is moved 'off screen Pin
Member 122530108-Jan-16 13:24
MemberMember 122530108-Jan-16 13:24 
AnswerRe: Object Data lost when dialog is moved 'off screen Pin
Richard Andrew x648-Jan-16 16:34
professionalRichard Andrew x648-Jan-16 16:34 
GeneralRe: Object Data lost when dialog is moved 'off screen Pin
Member 1225301011-Jan-16 6:45
MemberMember 1225301011-Jan-16 6:45 
QuestionHow to analyze what time Windows 7(XP) once run any program? Pin
AnsiliWork7-Jan-16 15:55
MemberAnsiliWork7-Jan-16 15:55 
SuggestionRe: How to analyze what time Windows 7(XP) once run any program? Pin
Richard MacCutchan7-Jan-16 23:08
mveRichard MacCutchan7-Jan-16 23:08 
GeneralRe: How to analyze what time Windows 7(XP) once run any program? Pin
AnsiliWork8-Jan-16 20:32
MemberAnsiliWork8-Jan-16 20:32 
QuestionRe: How to analyze what time Windows 7(XP) once run any program? Pin
David Crow8-Jan-16 12:56
MemberDavid Crow8-Jan-16 12:56 
AnswerRe: How to analyze what time Windows 7(XP) once run any program? Pin
AnsiliWork8-Jan-16 21:31
MemberAnsiliWork8-Jan-16 21:31 

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.