Click here to Skip to main content
15,900,511 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Close Dialog Box Problem Pin
Nishad S6-Nov-08 21:07
Nishad S6-Nov-08 21:07 
GeneralRe: Close Dialog Box Problem Pin
Dhiraj kumar Saini6-Nov-08 22:34
Dhiraj kumar Saini6-Nov-08 22:34 
QuestionCCheckListBox - DDX macro? Pin
devvvy6-Nov-08 18:57
devvvy6-Nov-08 18:57 
AnswerRe: CCheckListBox - DDX macro? Pin
MANISH RASTOGI6-Nov-08 19:35
MANISH RASTOGI6-Nov-08 19:35 
GeneralRe: CCheckListBox - DDX macro? Pin
devvvy6-Nov-08 22:28
devvvy6-Nov-08 22:28 
GeneralRe: CCheckListBox - DDX macro? Pin
Chandrasekharan P6-Nov-08 23:15
Chandrasekharan P6-Nov-08 23:15 
GeneralRe: CCheckListBox - DDX macro? Pin
David Crow7-Nov-08 3:02
David Crow7-Nov-08 3:02 
QuestionHow could I resolve this Problem Disabling a Menu item ? Pin
SherTeks6-Nov-08 18:56
SherTeks6-Nov-08 18:56 
I have the following two classes :

1) A CDialog derived CDlgClass
2) A CCmdTarget derived CAnotherClass

I am unable to disable an item of the launched context-menu.
Please follow the comments below to track the problem.

In DlgClass.cpp

ON_COMMAND(ID_MENUITEM1, OnMenuItemEdit1Clicked)
ON_UPDATE_COMMAND_UI(ID_MENUITEM1, OnUpdateMenuItemEdit1)

//On Right-clicking the dialog, this function is called
VOID CDlgClass::OnContextMenu(CWnd* pWnd, CPoint point)
{
	//Here, another class' ShowContextMenu is called to load the menu and show it
	m_pAnotherClass->ShowContextMenu( this, point);
}

void CDlgClass::OnMenuItemEdit1Clicked() 
{
	//Control reaches here when menu item 1 is clicked
}

void CDlgClass::OnUpdateMenuItemEdit1(CCmdUI* pCmdUI) 
{
	//Control is expected to reach here before the menu launches but doesn't do so. Why?
	//I am expecting menu Item 1 to be disabled before it shows up.

	pCmdUI->Enable(FALSE);
}

In AnotherClass.cpp

VOID CAnotherClass::ShowContextMenu(CWnd *pDlg, CPoint point) 
{
	CMenu cmCtxtMenu;

	cmCtxtMenu.LoadMenu(IDR_MENU_OPTIONS);
		
	CMenu *pcmPopupMenu = cmCtxtMenu.GetSubMenu(0);
	ASSERT(pcmPopupMenu);

	pcmPopupMenu->TrackPopupMenu (TPM_RIGHTBUTTON|TPM_LEFTALIGN, point.x, point.y, pDlg );
}


What could be the problem with disabling the menu item although I could actually activate the menu item handler
properly?

The function CDlgClass::OnUpdateMenuItemEdit1(CCmdUI* pCmdUI) itself is not getting called before launch of the menu,
when the menu is loaded in a different class.

What could be the reason ?

Thanks in Advance.
AnswerRe: How could I resolve this Problem Disabling a Menu item ? Pin
Mark Salsbery7-Nov-08 3:23
Mark Salsbery7-Nov-08 3:23 
QuestionFriendship problem in templates Pin
fhadi6-Nov-08 18:33
fhadi6-Nov-08 18:33 
QuestionRe: Friendship problem in templates Pin
CPallini6-Nov-08 21:46
mveCPallini6-Nov-08 21:46 
QuestionControlling one exe from another exe Pin
Chandrasekharan P6-Nov-08 18:32
Chandrasekharan P6-Nov-08 18:32 
AnswerRe: Controlling one exe from another exe Pin
Saurabh.Garg6-Nov-08 19:07
Saurabh.Garg6-Nov-08 19:07 
AnswerRe: Controlling one exe from another exe Pin
sashoalm6-Nov-08 20:51
sashoalm6-Nov-08 20:51 
QuestionDifference between a Dll and an ActivexDll Pin
lgatcodeproject6-Nov-08 18:01
lgatcodeproject6-Nov-08 18:01 
AnswerRe: Difference between a Dll and an ActivexDll Pin
Saurabh.Garg6-Nov-08 18:29
Saurabh.Garg6-Nov-08 18:29 
QuestionRe: Difference between a Dll and an ActivexDll Pin
lgatcodeproject6-Nov-08 18:48
lgatcodeproject6-Nov-08 18:48 
AnswerRe: Difference between a Dll and an ActivexDll Pin
Saurabh.Garg6-Nov-08 19:05
Saurabh.Garg6-Nov-08 19:05 
QuestionRe: Difference between a Dll and an ActivexDll Pin
lgatcodeproject6-Nov-08 19:31
lgatcodeproject6-Nov-08 19:31 
AnswerRe: Difference between a Dll and an ActivexDll Pin
Saurabh.Garg6-Nov-08 19:52
Saurabh.Garg6-Nov-08 19:52 
QuestionRe: Difference between a Dll and an ActivexDll Pin
lgatcodeproject6-Nov-08 20:11
lgatcodeproject6-Nov-08 20:11 
AnswerRe: Difference between a Dll and an ActivexDll Pin
Saurabh.Garg6-Nov-08 20:21
Saurabh.Garg6-Nov-08 20:21 
GeneralRe: Difference between a Dll and an ActivexDll Pin
lgatcodeproject6-Nov-08 20:44
lgatcodeproject6-Nov-08 20:44 
GeneralRe: Difference between a Dll and an ActivexDll Pin
Saurabh.Garg6-Nov-08 21:11
Saurabh.Garg6-Nov-08 21:11 
Questiongrab the result from sql query using visual c++ 2003 Pin
Arif Liminto6-Nov-08 17:13
professionalArif Liminto6-Nov-08 17:13 

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.