Michael Scribano
November 2nd, 2001, 02:14 PM
I have a context menu that pops up when the user right-clicks on a CView-derived window with a Richedit control.
It contains two menu items and works fine in Win2000, which is also the development environment. However, the menu does not appear on Win98 machines.
Any ideas? Thanks.
-Mike
ypyu
November 5th, 2001, 03:04 AM
TrackPopupMenu() should work for both Win98 and Win2k. Could you show your code segments here?
Michael Scribano
November 5th, 2001, 09:07 AM
Certainly. Thanks for taking the time to reply.
void CTextView::OnContextMenu( CWnd* , CPoint point )
{
CMenu mnuContext;
mnuContext.LoadMenu( IDR_CONTEXT );
CMenu* pPopup = mnuContext.GetSubMenu( 0 );
ASSERT( pPopup != NULL);
// Disable the Copy menu item if no text is highlighted.
if( editCtrl.GetSelectionType() == SEL_EMPTY )
{
pPopup->EnableMenuItem( ID_EDIT_COPY, MF_GRAYED );
}
else
{
pPopup->EnableMenuItem( ID_EDIT_COPY, MF_ENABLED );
}
pPopup->TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON,
point.x, point.y, this );
}
The code is pretty staightforward, so I'm looking at the Win98 PCs on which I've been testing the code for problems.
-Mike