Right Click for a Pop Up Menu

Does anyone have code to do this? I have Teach Yourself Visual C++ 6.0 and the code is in error. Here is the code.... anyone know what do do to fix it?

void cMenusDlg:: OnContextMenu(CWnd* pWnd, CPoint point)
{

CMenu *m_lMenu;
CPoint m_pPoint;
m_pPoint = point;
ClientToScreen(&m_pPoint);
m_lMenu - GetMenu(); // This shows many warnings... I tried = instead
// of - but then the menu pops up way far from the
// mouse pointer
m_lMenu = m_lMenu->GetSubMenu(0);
m_lMenu->TrackPopupMenu(TPM_CENTERALIGN + TPM_LEFTBUTTON,
m_pPoint.x, m_pPoint.y, this, NULL);
// end code of book
}



any responses would be greatly appreciated
[novabond]

Comments

  • [b][red]This message was edited by AsmGuru62 at 2002-8-13 19:2:31[/red][/b][hr]
    [b][red]This message was edited by AsmGuru62 at 2002-8-13 19:0:37[/red][/b][hr]
    : Does anyone have code to do this? I have Teach Yourself Visual C++ 6.0 and the code is in error. Here is the code.... anyone know what do do to fix it?
    :
    : void cMenusDlg:: OnContextMenu(CWnd* pWnd, CPoint point)
    : {
    :
    : CMenu *m_lMenu;
    : CPoint m_pPoint;
    : m_pPoint = point;
    : ClientToScreen(&m_pPoint);
    : [red]m_lMenu=m_pWnd->[/red]GetMenu(); // This shows many warnings... I tried = instead
    : // of - but then the menu pops up way far from the
    : // mouse pointer
    : m_lMenu = m_lMenu->GetSubMenu(0);
    : m_lMenu->TrackPopupMenu(TPM_CENTERALIGN + TPM_LEFTBUTTON,
    : m_pPoint.x, m_pPoint.y, this, NULL);
    : // end code of book
    : }
    :
    :
    :
    : any responses would be greatly appreciated
    : [novabond]
    :
    [blue]See RED... Your book is a 'little' off...

    Also, usually "m_" is a prefix for class variables, not for local vars. This code make my eyes hurt!

    My advice: get another book if all code in there like this one.[/blue]




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion