Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Add icon to listview's column?

Posted on 1999-06-27
7
Medium Priority
?
1,290 Views
Last Modified: 2013-12-03
Hello, I want to add icon to listview's column like outlook.
I mean the sub-item's state can be shown as an icon. when user click a column, I show or hide the icon in the row. Can you help me?
0
Comment
Question by:hello2000
[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
7 Comments
 

Expert Comment

by:afzalmj
ID: 1401368
Easy, use the ListView_??????? (e.g.ListView_DeleteAllItems or ListView_SetItemText, ListView_AddItem (I think - check under commctrl.h)) commands under commctrl.h.
They will be described under this header file, and you must include the library comctl32.lib for win32 apps when linking your prog.


0
 

Author Comment

by:hello2000
ID: 1401369
I want to use icon, not text.
0
 

Expert Comment

by:afzalmj
ID: 1401370
Can't u then use ListView_SetImageList ?
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 6

Expert Comment

by:WxW
ID: 1401371
1.LVM_SETIMAGELIST to make the ListView control to have icons .

2.LVM_INSERITEM with the LV_ITEM's iImage specifying the image index in the image list .

3.LVM_SETITEM to change any subitem's icons .
0
 

Author Comment

by:hello2000
ID: 1401372
It doesn't work. Please show some code. And I want to make it possible with original win95's comctl32.dll, not version 4.70 and later.
0
 
LVL 1

Expert Comment

by:dspellman
ID: 1401373
I tried to add icons to subitem columns using code from www.codeguru.com and other references, but I couldn't make it work with any combination of style flags.  If you haven't seen the samples at codeguru, you may have better luck than I did.
0
 
LVL 1

Accepted Solution

by:
fwilkinson earned 400 total points
ID: 1401374
Use this extended listview style:

#define LVS_EX_SUBITEMIMAGES    0x00000002

Version 4.70. Allows images to be displayed for subitems. This style is available only in conjunction with the LVS_REPORT style.  

You should be able to use this macro to set the style:

ListView_SetExtendedListViewStyleEx()

If that macro is not in your version of the SDK, use:

#define LVM_FIRST               0x1000
#define LVM_SETEXTENDEDLISTVIEWSTYLE (LVM_FIRST + 54)
SendMessage( hwndListView, SETEXTENDEDLISTVIEWSTYLE, LVS_EX_SUBITEMIMAGES, LVS_EX_SUBITEMIMAGES);

You will probably have to use an image list and item state flags in order to define the icons to display.



0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

722 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