Bei einem Tutorial hab ich zuerst ein Menu erstellt, dann dem Hauptdialog die Funktion WM_ONCONTEXTMENU hinzugefügt und folgenden Code eingegeben
void CMenusDlg::OnContextMenu(CWnd* pWnd, CPoint point)
{
// Declare local variables
CMenu *m_lMenu; //A pointer to the menu
CPoint m_pPoint; //A copy of the mouse position
//Copy the mouse position into the local variable
m_pPoint = point;
//Convert the position to a screen position
ClientToScreen(&m_pPoint);
//Get a pointer to the window menu
m_lMenu - GetMenu();
//Get a pointer to the first submenu
m_lMenu = m_lMenu -> GetSubMenu(0);
//Show the popup menu
m_lMenu -> TrackPopupMenu(TPM_CENTERALIGN + TPM_LEFTBUTTON,
m_pPoint.x, m_pPoint.y, this, NULL);
}
Wenn ich das Programm nun starte und auf dem Fenster einen Rechtsklick mache, Bekomme ich einen Runtime Error
"Menus.exe hat ein Problem festgestellt und muss beendet werden"
Was könnten denn die Fehlerquellen sein?
Martin