?
Solved

Displaying Popupmenu over a List Contol

Posted on 2003-03-04
2
Medium Priority
?
327 Views
Last Modified: 2013-11-20
Hi,
    How to display a Pop up meny when i right-
    click on a CListControl widget,

    I tried by adding onRightClick function, but this
    does not return me the current clicked mouse position.

void CTestDlg::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here


     *pResult = 0;
}

Regards
Prashanth
0
Comment
Question by:prashanthgn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 150 total points
ID: 8070185
You can use GetCursorPos to get screen cursor coordinates. Don't forget to convert them to client dialog/list coordinates.
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 8070213
void CTestDlg::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
{
     if( m_wndListCtrl.GetSelectedCount() )
     {
          CMenu     oMenu;
         
          // IDR_POPUPMENU - menu added in the resource
          if( !oMenu.LoadMenu(IDR_POPUPMENU) )
          {
               *pResult = 0;
               return;
          }

          // Getting first submenu of the resource added menu
          CMenu     *pSubMenu = oMenu.GetSubMenu(0)     ;
          POINT     oPoint;

          GetCursorPos(&oPoint);

          pSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
                                         oPoint.x,
                                         oPoint.y,
                                         this);

          pSubMenu->DestroyMenu();
          oMenu.DestroyMenu();
     }
     
     *pResult = 0;
}

Good Luck
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question