|
-
May 26th, 2005, 09:53 PM
#1
Thread Starter
Addicted Member
How do I associate system image list to ListView control in VB6
Hi,
Can anyone tell me how do I associate system image list to a listview control so that I'm able to get correct icons for files and folders.
Regards,
Piyush
-
Jun 3rd, 2005, 08:55 AM
#2
Addicted Member
Re: How do I associate system image list to ListView control in VB6
I'm not sure you should.
I asked a simular question sometime back about using Windows icons in my app. The replies that I got back suggested that they are copywrited.
-
Jun 3rd, 2005, 10:12 AM
#3
Thread Starter
Addicted Member
Re: How do I associate system image list to ListView control in VB6
No they are not. Using a few functions of shell32.dll and vb accelerator's system image list you can do this. I've done this in tree view but unable to set icons in listview as it only understand vb's image list for icons and when I try to associate that image list with system's image list everything crashes.
-
Jun 3rd, 2005, 10:30 AM
#4
Re: How do I associate system image list to ListView control in VB6
They are copyrighted, but you're not copying them, you'r merely using them. I've done it myself, using the vbAccelerator code. You need to include the class module cVBALSysImageList.cls in your project. Then to use the images, do this:
VB Code:
' Declarations in the form code
Private mobjCSysIML As cVBALSysImageList
' In Form_Load
Set mobjCSysIML as New cVBALSysImageList
' To add a node to a treeview
tvwBrowser.Nodes.Add([Relative], [Relationship, [Key], [Name], mobjCSysIML.ItemIndex([Path of file whos icon you want to show]))
-
Jun 3rd, 2005, 08:45 PM
#5
Thread Starter
Addicted Member
Re: How do I associate system image list to ListView control in VB6
I think you didn't read the very first thing I asked so let me repeat it once again:
I want to associate system imgae list to a LISTVIEW control and not TREEVIEW as I've already done it.
-
Jun 3rd, 2005, 09:20 PM
#6
Re: How do I associate system image list to ListView control in VB6
Do you mean like this? I can't post the code legally, so here is a link:
http://vbnet.mvps.org/index.html?cod...eckboxmeth.htm
-
Jun 3rd, 2005, 09:21 PM
#7
Re: How do I associate system image list to ListView control in VB6
Do you mean like this? I can't post the code legally, so here is a link:
http://vbnet.mvps.org/index.html?cod...eckboxmeth.htm
You can use it for yourself, but you can't post in on the web.
-
Jun 3rd, 2005, 11:02 PM
#8
Software Eng.
Re: How do I associate system image list to ListView control in VB6
Recall, the ExtractIcon API is used to retrieve an icon from its module. Find out which module these icons are stored in (Shell32.dll, I believe) and call this function, specifying the correct icon index to retrieve the icon.
Of course, you will need to know the correct indicies of the icons you wish to extract. This can be done via an icon viewer (Or just write your own program).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|