MorganGreylock
Programmer
Hello,
I'm using the 'Learn Visual C++ in 21 Days' Book (day 6)
and here's my problem code:
The context menu is popping up, but always in the wrong
spot. Its always lower and more right than my window. If
I move my cursor and right-click again, the popup menu
moves the same distance from the original location, but
still in the wrong place.
In other words, it just seems that there is a number being
added to the x and y coordinates of the point.
The book says to use GetMenu(), although I've seen
references to LoadMenu() in this forum. Is there a reason
to use one over the other?
Much appreciated,
MG
I'm using the 'Learn Visual C++ in 21 Days' Book (day 6)
and here's my problem code:
Code:
CMenu *m_lMenu;
CPoint m_pPoint;
m_pPoint = point;
ClientToScreen(&m_pPoint);
m_lMenu = GetMenu();
m_lMenu = m_lMenu->GetSubMenu(0);
m_lMenu->TrackPopupMenu(TPM_CENTERALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
m_pPoint.x, m_pPoint.y, this, NULL);
The context menu is popping up, but always in the wrong
spot. Its always lower and more right than my window. If
I move my cursor and right-click again, the popup menu
moves the same distance from the original location, but
still in the wrong place.
In other words, it just seems that there is a number being
added to the x and y coordinates of the point.
The book says to use GetMenu(), although I've seen
references to LoadMenu() in this forum. Is there a reason
to use one over the other?
Much appreciated,
MG