Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Handling double click event on items in CListCtrl

Posted on 2006-04-21
3
Medium Priority
?
6,735 Views
Last Modified: 2013-11-20
I am doing a poject in Win32 App that uses CListCtrl class.I want to know how to handle the double click event on items and know which item the user clicked on. Also when the user double clicks the item I want to open a note pad window that displays details of the clicked item. Please tell me what message map/message handler I should add to achieve this.

Thanks

Jejo
0
Comment
Question by:jejob007
  • 2
3 Comments
 
LVL 3

Expert Comment

by:NeoEGM
ID: 16512656
Hi Jejo, the message you have to handle to accomplish this is the NB_DBLCLK...

For you to know what item is selected you just have to call: pListCtrl->GetSelectionMark();

Then you can call pListCtrl->GetItemText(pListCtrl->GetSelectionMark(), nSubItemToQuery) to get the corresponding text for each column...

Then you can output it to a text file and open it using:

ShellExecuteA(NULL, "open", pszFileNamePath, NULL, NULL, SW_SHOW);


Hope it helps...

Regards,
NeoEGM
0
 

Author Comment

by:jejob007
ID: 16513755
Hi NeoEGM thanks for your valuable comment.

Selecting items and opening file works fine but still can you please elaborate more on the NB_DBCLK message.How do I handle this message.What function do  I write and what should I write in declare message map area.

Thanks

Jejo
0
 
LVL 3

Accepted Solution

by:
NeoEGM earned 200 total points
ID: 16515081
This would be a generic message map for you to handle the message...

BEGIN_MESSAGE_MAP(CWindowClass, CBaseWindowClass)
          [...]
          ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnNMDblclkList1)
END_MESSAGE_MAP()

Anyway, if you are using VisualStudio, you could just make it write it for you... Just right click the ListCtrl in the dialog and go to AddEventHandler...

Regards,
NeoEGM
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

577 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