Click here to Skip to main content
13,296,377 members (57,588 online)
Click here to Skip to main content
Add your own
alternative version


21 bookmarked
Posted 25 Feb 2008

A list control with hyperlink function

, 26 Feb 2008
Rate this:
Please Sign up or sign in to vote.
This control provides hyperlink function for the list control with exact positioning for the cursor.


This code provides a way for adding hyperlink function for the CListCtrl.


When I searched a method to do this, on The Code Project, I noticed that most of the available code provided the function, but not perfectly. When the cursor moves on the cell of the grid, the hyperlink works, but not the words. So, I decided to write code to provide the function in a better way.

Using the code

The basic class is CReportCtrl which is derived from CListCtrl.

The usage of CReportCtrl is quite simple, just like this:

m_list.SetColumnHeader(_T("no, 40, 1; name, 290, 1; link, 70, 1"));
m_list.InsertItem( 0 , _T(""));
m_list.SetItemText(0, 0, 1);
m_list.SetItemText(0, 1, "website");
m_list.SetItemText(0, 2, "baidu");
m_list.SetItemURL(0, 2,"","search website -");
m_list.InsertItem(1, _T(""));
m_list.SetItemText(1, 0, 1);
m_list.SetItemText(1, 1, "gg");
m_list.SetItemText(1, 2, "google");
m_list.SetItemURL(1, 2,"", "search website -");




This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

China China
No Biography provided

You may also be interested in...


Comments and Discussions

Generalgood job Pin
Anu Koshy2-Jun-10 19:26
memberAnu Koshy2-Jun-10 19:26 
Excellent article to start with. Smile | :)
GeneralThank you Pin
Portatofe2-Oct-08 9:32
memberPortatofe2-Oct-08 9:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171207.1 | Last Updated 26 Feb 2008
Article Copyright 2008 by liuxiao
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid