• Advertisement


This topic is now archived and is closed to further replies.

Hide / Show Menu while mousemove in a rect area

This topic is 5536 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all~ Nice to meet you both ~ I''m try to hide / show a menu while mousemove in a rect area, althought it complied with no error, it still not work. While my mouse move to the defined Rect area( i.e. CRect rect(0, 0, 600, 20) ) , programme alert "Debug Assertion Failure". My programme is a SDI App, and here is the code: //////////////////////////////////////////////////////////// // MainFrm.h - member variable to store menu //////////////////////////////////////////////////////////// public: CMenu* m_Menu; //////////////////////////////////////////////////////////// // Store the menu and hide it //////////////////////////////////////////////////////////// int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { ....... ............. m_Menu = GetMenu(); MenuDisplay(false); return 0; } //////////////////////////////////////////////////////////// // OnMouseMove event - call the MenuDisplay function while mouse move to defined rect area //////////////////////////////////////////////////////////// void CMainFrame::OnMouseMove(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CRect rect(0, 0, 600, 20); if (rect.PtInRect(point)) //MessageBox("asdf","ttt",MB_OK); <= I try this can be show correctly MenuDisplay(true); CFrameWnd::OnMouseMove(nFlags, point); } //////////////////////////////////////////////////////////// // MenuDisplay - function to access menu control //////////////////////////////////////////////////////////// void CMainFrame::MenuDisplay(bool show) { if (show == true) SetMenu(m_Menu); else SetMenu(NULL); } Can anyone give me some tips where did it go wrong ? Thanks a lot ~~~~ ''''I think, therefore I am.'''' -- Descartes

Share this post

Link to post
Share on other sites

  • Advertisement