-
Menu event not working
Hi
i am making a dialog based project in MFC using VS2005. The problem is that i am craeting menu on button click As a click a button menu is open properly. but if i am given control on that pop up menu nothing happen.
i am giving some code.
plz help me.
this is the code on button click event
CMenu *pContextMenu=NULL ;
pContextMenu = menu.GetSubMenu (0);
CWnd* pWnd = GetDlgItem(IDC_NETSTAG);
if ( !pWnd )
return ;
CRect rect;
pWnd->GetWindowRect( &rect );
// Show the Menu
int nCmd = pContextMenu->TrackPopupMenu (TPM_LEFTALIGN |
TPM_RETURNCMD,
rect.left, rect.bottom,
AfxGetMainWnd() );
this is the code on menu handler
CSampleDlg::OnLogin
{
AfxMessageBox ("Baher jao");//this is not fire after displaing opup menu.
}
thanks .