CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: popup menu

  1. #1
    Guest

    popup menu

    how can i create a popup-contetxmenu (e.g when i click somewhere in the document window)? i created a menubar in the resourceeditor but will it work with an ordinary meunbar? how do I create and display such a menu?


  2. #2
    Join Date
    Jul 1999
    Location
    Romania - Iasi
    Posts
    558

    Re: popup menu

    1)In resource editor create a menu resource
    2)Go to menu item properties and at caption type a space(no name but u must type something so type a space)
    3)Then add to this no name menu all items you need, then try this function:

    void CInsCol::OnRButtonDown(UINT nFlags, CPoint point)
    {
    CMenu m_Menu;
    CPoint point;
    GetCursorPos(&point);
    m_Menu.LoadMenu( IDR_MENU1 );
    CMenu* pPopup = m_Menu.GetSubMenu( 0 );
    pPopup->TrackPopupMenu( TPM_RIGHTBUTTON, point.x, point.y, this );

    CDialog::OnRButtonDown(nFlags, point);
    }





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured