Howdy, Stranger!

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

Categories

Right Click for a Pop Up Menu

novabondnovabond Member Posts: 12
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

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [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]




  • Justin BibJustin Bib USAMember Posts: 0

    _________ < http://forcoder.org /> free ebooks and video tutorials about [ Ruby C# MATLAB PHP JavaScript Scratch Python Visual Basic .NET Visual Basic PL/SQL C Go Delphi Perl Assembly C++ Swift Objective-C Java R Julia Scala VBScript Ada Bash Dart Lisp Apex ABAP Kotlin Prolog Clojure Crystal D Logo Rust SAS Hack ML Alice F# Erlang Scheme COBOL Transact-SQL Awk Fortran Lua FoxPro LabVIEW ] ______

Sign In or Register to comment.