Hi, I was learning this Context Menu example based on an e-book where I've been supplied with this code
The compilation went smoothly except there are 2 warnings on line 18 and 20.Code:1: void CMenusDlg:: OnContextMenu(CWnd* pWnd, CPoint point) 2: { 3: // TODO: Add your message handler code here 4: 5: /////////////////////// 6: // MY CODE STARTS HERE 7: /////////////////////// 8: 9: // Declare local variables 10: CMenu *m_lMenu; // A pointer to the menu 11: CPoint m_pPoint; // A copy of the mouse position 12: 13: // Copy the mouse position to a local variable 14: m_pPoint = point; 15: // Convert the position to a screen position 16: ClientToScreen(&m_pPoint); 17: // Get a pointer to the window menu 18: m_lMenu - GetMenu(); 19: // Get a pointer to the first submenu 20: m_lMenu = m_lMenu->GetSubMenu(0); 21: // Show the Popup Menu 22: m_lMenu->TrackPopupMenu(TPM_CENTERALIGN + TPM_LEFTBUTTON, 23: m_pPoint.x, m_pPoint.y, this, NULL); 24: 25: /////////////////////// 26: // MY CODE ENDS HERE 27: /////////////////////// 28: }
Nevertheless, the application runs, but when I do a right click on the form, it crashes.....
Any idea what's wrong with it?
Thanks for any help
Harddisk
PS:It's an MFC exe




Reply With Quote