Click here to Skip to main content
15,886,026 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
SuggestionRe: doubt in typdef segregation one class in two Pin
Jochen Arndt12-Jan-16 20:53
professionalJochen Arndt12-Jan-16 20:53 
QuestionVisual Studio 2016 & MFC Pin
BarryPearlman11-Jan-16 16:54
BarryPearlman11-Jan-16 16:54 
AnswerRe: Visual Studio 2016 & MFC Pin
Jochen Arndt11-Jan-16 20:52
professionalJochen Arndt11-Jan-16 20:52 
QuestionMFC, Cannot disable Menu option from Child View Pin
Member 1120327711-Jan-16 4:30
Member 1120327711-Jan-16 4:30 
AnswerRe: MFC, Cannot disable Menu option from Child View Pin
Richard MacCutchan11-Jan-16 5:59
mveRichard MacCutchan11-Jan-16 5:59 
GeneralRe: MFC, Cannot disable Menu option from Child View Pin
Member 1120327711-Jan-16 7:23
Member 1120327711-Jan-16 7:23 
GeneralRe: MFC, Cannot disable Menu option from Child View Pin
Richard MacCutchan11-Jan-16 21:23
mveRichard MacCutchan11-Jan-16 21:23 
AnswerRe: MFC, Cannot disable Menu option from Child View Pin
Jochen Arndt11-Jan-16 21:30
professionalJochen Arndt11-Jan-16 21: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 3:51
Member 1120327712-Jan-16 3:51 
QuestionHow to change a alignment of CStatic Label at run time? Pin
Le@rner9-Jan-16 1:52
Le@rner9-Jan-16 1:52 
AnswerRe: How to change a alignment of CStatic Label at run time? Pin
Richard MacCutchan9-Jan-16 2:46
mveRichard MacCutchan9-Jan-16 2:46 
GeneralRe: How to change a alignment of CStatic Label at run time? Pin
Le@rner10-Jan-16 18:29
Le@rner10-Jan-16 18:29 
QuestionRe: How to change a alignment of CStatic Label at run time? Pin
Richard MacCutchan10-Jan-16 20:56
mveRichard MacCutchan10-Jan-16 20:56 
AnswerRe: How to change a alignment of CStatic Label at run time? Pin
Le@rner12-Jan-16 18:23
Le@rner12-Jan-16 18:23 
GeneralRe: How to change a alignment of CStatic Label at run time? Pin
Richard MacCutchan12-Jan-16 21:20
mveRichard MacCutchan12-Jan-16 21:20 
QuestionHow to determine whether the disk is bitlocker? Pin
AnsiliWork8-Jan-16 19:29
AnsiliWork8-Jan-16 19:29 
AnswerRe: How to determine whether the disk is bitlocker? Pin
Richard MacCutchan8-Jan-16 22:51
mveRichard MacCutchan8-Jan-16 22:51 
QuestionObject Data lost when dialog is moved 'off screen Pin
Member 122530108-Jan-16 12:24
Member 122530108-Jan-16 12:24 
AnswerRe: Object Data lost when dialog is moved 'off screen Pin
Richard Andrew x648-Jan-16 15:34
professionalRichard Andrew x648-Jan-16 15:34 
GeneralRe: Object Data lost when dialog is moved 'off screen Pin
Member 1225301011-Jan-16 5:45
Member 1225301011-Jan-16 5:45 
QuestionHow to analyze what time Windows 7(XP) once run any program? Pin
AnsiliWork7-Jan-16 14:55
AnsiliWork7-Jan-16 14:55 
SuggestionRe: How to analyze what time Windows 7(XP) once run any program? Pin
Richard MacCutchan7-Jan-16 22:08
mveRichard MacCutchan7-Jan-16 22:08 
GeneralRe: How to analyze what time Windows 7(XP) once run any program? Pin
AnsiliWork8-Jan-16 19:32
AnsiliWork8-Jan-16 19:32 
QuestionRe: How to analyze what time Windows 7(XP) once run any program? Pin
David Crow8-Jan-16 11:56
David Crow8-Jan-16 11:56 
AnswerRe: How to analyze what time Windows 7(XP) once run any program? Pin
AnsiliWork8-Jan-16 20:31
AnsiliWork8-Jan-16 20: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.