Click here to Skip to main content
13,143,637 members (28,817 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have dll that coded by win32 and using resource.
I am using Listbox control in this dll.

case IDC_LIST1:
int index = SendDlgItemMessage(hDlg, IDC_LIST1, LB_ADDSTRING, (LPARAM)"RR", (LPARAM)"");

I add content to listbox with above lines.
I want show one string include hyperlink in my List box. How I must do that?
With above code it only show static text.
Posted 19-Nov-12 20:39pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If working with win32 (no MFC) take a look at this to change color of items in the list:

Using ListView control under Win32 API[^]

This part of the article says it all:
"You won't believe how much time I took to dig this up to actually work! I mean, 99.99% examples were MFC only!
So here we go, finally, pure WinAPI code for listview colors."

If you can use MFC, this this article shows an hyperlink:

CGridListCtrlEx - Grid Control Based on CListCtrl[^]

Hope it helps.
Sergey Alexandrovich Kryukov 28-Nov-12 19:51pm
Right, good points, a 5.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

The ListBox control does not understand hyperlinks, only strings. However, you can use the LBS_OWNERDRAWFIXED style, as described in this MSDN page[^], and provide your own message handling to add such functionality.
Espen Harlinn 20-Nov-12 10:10am
Sergey Alexandrovich Kryukov 28-Nov-12 19:51pm
Agree, a 5.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Have a look at Create your own controls - the art of subclassing[^]

You can subclass the listbox, and keep track of when your item should be visible. Create a SysLink[^] control and place it over your item.

Best regards
Espen Harlinn
Richard MacCutchan 20-Nov-12 10:16am
And a 5 for you; I forgot about this control.
Espen Harlinn 20-Nov-12 10:17am
Thank you, Richard :-D
Sergey Alexandrovich Kryukov 28-Nov-12 19:51pm
Good one, a 5.
Espen Harlinn 29-Nov-12 3:44am
Thank you, Sergey :-D
Mika Wendelius 12-Dec-12 0:19am
Good control to remember :)
Espen Harlinn 12-Dec-12 9:37am
Thank you, Mika :-D

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 20 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100