Loading TreeView And Listview Icons From A Specified Folders Or Files Icons.
Hello,
I am creating a treeview app that looks like windows explorer. Problem is that I do not know how to get the Treeview + Listview icons from the folder or file items being loaded.
Can anyboby help please................................
Thanks
vbBoy.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
ListView/TreeView Icons???
I have made my own chat client with both text and voice, it works pretty good with no bugs as of yet, but it does not have alot of features, this is only my second program made with VB6 so its all really new to me, right now I have my chatters list as ChatList but was told I needed to change it to ListView or TreeView to be able to link it to a ImagineList for user status IE cam, Voice, etc. I have no clue where to start with this is there any code examples anywhere I could see how this is done. Also I want too be able to view nicknames instead of user names any ideas there. this program is yahoo chat based if that matters any.
TreeView And ListView Icons For VB6
I am writing a VB 6.0 program similar to Windows Explorer, which has a tree
view and a list view to select directories and files. I would like to
associate an icon with each file, according to the standard file extension,
or use application file's own icon, just like the Explorer does.
It is quite easy to place a icon using the ImageList control, together with
the "TreeView.Nodes.Add" and "ListItem.SmallIcon" methods. The question is,
how do these get into the ImageList in the first place? Since there are
dozens of standard file types and icons, can I get a list from the system at
run time? How do we extract the icon associated with an application? Do I
need a huge Select Case to choose the correct image key? There must be an
easier way!
Thanks and regards,
Garet
Get Icons For Associated Files And Place In ListView
What is the best way to grab icons from files and place them in a list view control? I've been using the following APIs:
VB Code:
Public Declare Function SHGetFileInfo Lib "shell32.dll" Alias "SHGetFileInfoA" (ByVal pszPath As String, ByVal dwFileAttributes As Long, psfi As typSHFILEINFO, ByVal cbSizeFileInfo As Long, ByVal uFlags As Long) As LongPublic Declare Function ImageList_Draw Lib "comctl32.dll" (ByVal himl&, ByVal i&, ByVal hDCDest&, ByVal x&, ByVal y&, ByVal Flags&) As Long
Using ImageList_Draw it puts the icons into an image list control
and then I just grab the icons from there and place in the list view that way. This works fine until it tries to load 600 or so icons in the ImageList.
Any ideas that you have used would be helpful.
FYI - I'm building a file search utility much like windows and I want
the files that it finds to display the associated icon next to it.
If it is an icon file, it needs to show the icons in that icon file.
Thanks for any help.
Loading Folders/files In Listview Is Slow ???
Hi,
I am writing a Backup Application using VB6. Here I need to show treeview and listivew with Directories and Files like Windows explorer and allow user to select or drag files for backup. I have populated directory tree. that is fine. But in case of listview for showing selected Directory contents with windows icons I am using Filesystemobject and then getting windows icons for the files and directories. In case of large directory it is taking time to load the files and directories. I treid with Findfirstfile and findnextfile apis also. still it is slow. Can anybody suggest me some good way of loading the files and folders in the listview with windows associated icons?
thanking you
regards
praveenp
Loading Folders And Files In Listview Is Slow ???
Hi,
I am writing a Backup Application using VB6. Here I need to show treeview and listivew with Directories and Files like Windows explorer and allow user to select or drag files for backup. I have populated directory tree. that is fine. But in case of listview for showing selected Directory contents with windows icons I am using Filesystemobject and then getting windows icons for the files and directories. In case of large directory it is taking time to load the files and directories. I treid with Findfirstfile and findnextfile apis also. still it is slow. Can anybody suggest me some good way of loading the files and folders in the listview with windows associated icons?
thanking you
regards
praveenp
Loading Files/folders In Listview Is Slow ???
Hi,
I am writing a Backup Application using VB6. Here I need to show treeview and listivew with Directories and Files like Windows explorer and allow user to select or drag files for backup. I have populated directory tree. that is fine. But in case of listview for showing selected Directory contents with windows icons I am using Filesystemobject and then getting windows icons for the files and directories. In case of large directory it is taking time to load the files and directories. I treid with Findfirstfile and findnextfile apis also. still it is slow. Can anybody suggest me some good way of loading the files and folders in the listview with windows associated icons?
thanking you
regards
praveenp
ListView + Files + Directories + Icons = NewControl I Need
Is there a control that u can browse trough, just like the explorer window? I want to be able to double click and execute a file just like u do in a normal folder, all i need is a control that looks like that.
I really dont want to use the Dir and FileList controls
Viewing Files And Folders Using Treeview And Listview Control
hi
I got this code to display files and folders using treeview and listview control from Mastering vb6.0 Book but when i run it it shows the error :
'Element Not Found'.
The code is as follows:
Dim fso As New FileSystemObject ' Declared in the general section
Private Sub Form_Load()
lwidth = ListView1.Width - 5 * Screen.TwipsPerPixelX
ListView1.ColumnHeaders.Add 1, , "File Name", 0.3 * lwidth
ListView1.ColumnHeaders.Add 2, , "Size", 0.2 * lwidth, lvwColumnRight
ListView1.ColumnHeaders.Add 3, , "Created", 0.25 * lwidth
ListView1.ColumnHeaders.Add 4, , "Modified", 0.25 * lwidth
'Set fsys = CreateObject("Scripting.filesystemobject")
initpath = "C:Windows"
TreeView1.Nodes.Add , tvwFirst, UCase(init_path), initpath
Me.Show
Screen.MousePointer = vbHourglass
DoEvents
scanfolder (initpath)
Screen.MousePointer = vbDefault
End Sub
Sub scanfolder(folderspec)
Dim thisfolder As Folder
Dim allfolders As Folders
Set thisfolder = fso.GetFolder(folderspec)
Set allfolders = thisfolder.SubFolders
For Each thisfolder In allfolders
TreeView1.Nodes.Add UCase(thisfolder.ParentFolder.Path), tvwChild, UCase(thisfolder.Path), thisfolder.Name
scanfolder (thisfolder.Path)
Next
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
Dim thisfolder As Folder
Dim thisfile As File
Dim allfiles As Files
Dim thisitem As ListItem
Screen.MousePointer = vbHourglass
ListView1.ListItems.Clear
Set thisfolder = fso.GetFolder(Node.Key)
Set allfiles = thisfolder.Files
If allfiles.Count > 0 Then
On Error Resume Next
For Each thisfile In allfiles
Set thisitem = ListView1.ListItems.Add(, , thisfile.Name)
thisitem.SubItems(1) = Format(thisfile.Size, "###,###,###")
thisitem.SubItems(2) = Left(thisfile.DateCreated, 8)
thisitem.SubItems(3) = Left(thisfile.DateLastModified, 8)
If thisfile.Attributes And System Then thisitem.Ghosted = True
Next
End If
Screen.MousePointer = vbDefault
End Sub
Can any one help me get rid of this bug?
Thanx in advance
amrita
Icons - Folders
Hi,
I'm using icons in a treeview to show 'folders' opened or closed.
Where can I find a nice icon for folders, one for a closed folder, and one for an open folder. Anyone?
thanks!
TreeView With CPU Icons
Ok Everyone. I think this is an easy request.
I have a program that will list all of my domain nodes. The program currently puts the information into a list box. I want to do this using a TreeView, which I have, but I can't get an icon associated with the list.
How do I assign a .ico file or an icon picture. I tried copying this from another posted program but I keep getting an "ImageList must be initialized" error.
Please help.
Chris, Baltimore.
TreeView Icons
Hi
I'm adding items to a TreeView. It has references to an ImageList. The icons in this list are initially ok, but then they change - all the white space around each item becomes black.
What is going on ?
If I delete these icons, then re-insert then, they stay ok initially, then revert to black background.
Thanks
Robert
TreeView Icons
Hi All:
I'm having a royal fit with icons used with the TreeView control and I'm hoping SOMEONE out there can help me!
Here's the situation: I've got a TreeView and have associated it to an ImageList. In the ImageList I have loaded the various icons I wish to use along with meaningful names so that each icon may be referenced by its name. If I start by loading the icons from those provided with VB, the ImageList defaults to a 32x32 size and will NOT let me change it. And, when used, the icons on the TreeView are HUGE. Dragging an node, though, uses the associated icon for the node, which looks good.
The spacing, though, when using 32x32 icons is just not acceptable in the TreeView. So, I created another ImageList, set its size to 16x16, and loaded in the same icons. The size stayed put at 16x16, and the icons actually resize themselves rather intelligently on the TreeView. But now, when I drag around a node, the icon displayed is back to 32x32, which wouldn't be all that bad except for the fact that the 32x32 icon is created from the 16x16 image, so it looks like crap.
My next thought was to start with 16x16 icons, so I tried my hand at creating icons similar to what the 32x32 versions presented, just in a 16x16 size. These load nicely onto the TreeView, but, once again, the image presented when dragging a node is an interpolated 32x32 image which is quite blocky and ugly as anything.
I am using the CreateDragImage method of the TreeView control to assign the image from the node to the TreeView's DragIcon. What am I doing wrong? Can anyone point me in the right direction to get this thing to use icons at the size I want without the horrible blockiness I'm seeing when I drag nodes?
Thanks in advance!
Jon
Treeview Icons
Hi,
I have a treeview control. What I want is for all root nodes to have "folder" icons (same as Windows Explorer, when the node is expanded the icon shows an "open" folder, and a "closed" folder when collapsed).
Also I want child nodes of each root node to have a checkbox such that more than one child node can be checked at a time.
I've tried playing around with the checkboxes property of the treeview control but had no success. Any help would be greatly appreciated.
Thanks very much,
dhartigan
Loading Icons From .RES File
Hi,
In my program, I'm loading icons from the .RES file into an image control using LoadResPicture(ID, vbResIcon).
How can I tell which icon is currently loaded in my image control?
Loading Default Icons
i made an explorer like program, can any one tell me how to load the default icons for the programs.
Loading Icons Into Dropdown Box
Hey my helpful little friends, anyone know how (hopefully without use of OCX) I can load directory structure, including the icons, into an Image Combo box, such as the one used in the common dialog's open dialog?
Help is much appriciated.
-Micah
Loading Icons Into Dropdown Box
Hey my helpful little friends, anyone know how (hopefully without use of OCX) I can load directory structure, including the icons, into an Image Combo box, such as the one used in the common dialog's open dialog?
Help is much appriciated.
-Micah
Changing Treeview Icons
Hi,
If had a treeview and an imagelist on the same form. If I had previously loaded the treeview with all the icons and everything, is it possible for me to go back and Change (not add) the icon for a specific node at runtime without having to reload the treeview?
Keep in mind that I already know the name of the node that I want to change.
Thanks
[Edited by omarswan on 04-25-2000 at 06:07 AM]
File-icons In Treeview
I have a treeview I am loading with names of files present on a remote server. I would like to show the corresponding Icon for each filetype, by "sucking" them out of windows.
Any ideas?
Loading Icons/images/pictures.
hai guys,
am doing project which involves the use of alot of icons/images/pictures.
i decided that; i use 0ne icon/image/picture on each Form that is loaded.
But i noted that i was going to use alot of space and forms!
is it possible to use 1 form to load different icons/images/pictures after every click on a command button?
thank you guys!
Treeview Multi Level Icons
Doe any body know if you can set a different treeview icon for parents and child nodes. Any help greatfully recieved
Icons Missing From Toolbar And Treeview
I have an app that runs fine on all computers except one. On this computer it is missing some buttons on the toolbar (others do show) and the icon in the treeview is blank. I use an Installshield installation so all installations are the same. I would guess that a Windows DLL or OCX is out of date but I am not able to track this down. The computer is running XP.
Vanishing Treeview Control Icons
I am using VB6 and have the latest SP5 installed.
The problem is that the icons on my treeview control vanish sometimes and can not be brought back programically. The user must close and re-open the app.
The tv control is placed on a picture box which is frequently made visible and invisible (icons vanish whether the control is visible or not). The control is frequently updated by an inprocess server. The icons vanish at seemingly random intervals. Sometimes 5 minutes and sometimes days.
I have the same problem regardless of the computer or os i'm using.
Nasty little problem. Does anyone have an answer.
Treeview And Toolbar Icons Not Displaying
I have an app that runs fine on all computers except one. On this computer it is missing some buttons on the toolbar (others do show) and the icon in the treeview is blank. I use an Installshield installation so all installations are the same. I would guess that a Windows DLL or OCX is out of date but I am not able to track this down. The computer is running XP.
Drag And Drop Icons In Treeview
Hi,
I have a problem with the treeview control in vb6.0. When I drag a file in the tree I get the icon resized to 32x32.
How do I achieve the same behaviour as the explorer have where it doesn't resize the icons on drag and drop?`
Cheers
Loading Icons From A .res File Messes Up Colors
I have an MDI ap that needs to display color coded icons for it's forms depending on the information the form is displaying. No problem I thought, just load up 5 different color icons into a .res file and set the form icon when the form displays. Problem is, my nice 256 color icons get squeezed down to 8 colors (see image attached - left of the shot is Explorer, right is my ap).
I found this thread where they ran into the same problem, but no solution. Anybody know of a workaround? The icons look fine when I add them to forms directly in the IDE property window. I'm loading the icons like this:
Code:
Select Case eColor
Case fcBlue
Me.Icon = LoadResPicture(fiBlue, vbResIcon)
Case fcRed
Me.Icon = LoadResPicture(fiRed, vbResIcon)
Case fcManilla
Me.Icon = LoadResPicture(fiManilla, vbResIcon)
Case fcGreen
Me.Icon = LoadResPicture(fiGreen, vbResIcon)
Case fcSilver
Me.Icon = LoadResPicture(fiSilver, vbResIcon)
End Select
Loading Bitmaps, Strings, Icons From Resource DLL
Hello!
Can anyone tell me how can I retrieve images (bitmaps and icons) and strings from resoruce DLL? I already heard for one activex Dll, but it's just trial version and I'd like to make my program without that DLL, because it makes nags.
Regards
Zvonko
How To Change Icons And What Type Of Icons Will Be Supported In VB
hello every body.
My name is bharath.Our company wants to release a new version of their application done in vb and want to have a new look with new icons,new themes.
could any of u please suggest me that what type of icons will be used in visual basic how can i get 16x16 size icons.
How to get a new look to my old vb application.
bye
Getting Those Pretty Microsoft Icons Into A Treeview And/or Imagelist
Hi,
I have searched my hard drive for suitable icons to use for a project, but they just don't match up to the ones that Microsoft uses in their explorer, mmc console, etc.
I did find some code on the net that helped me write a sample program to put these icons into a picture box, but i am trying to use them in my treeview and/or imagelist control.. All the code returned was a long number that I don't quite know what to do with..
below is the code that got me started..
thanks in advance for your help..
Code:
Option Explicit
Private Const MAX_PATH = 260
Private Declare Function GetSystemDirectory Lib "kernel32" Alias _
"GetSystemDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
Private Declare Function ExtractIcon Lib "shell32.dll" Alias _
"ExtractIconA" (ByVal hInst As Long, _
ByVal lpszExeFileName As String, _
ByVal nIconIndex As Long) As Long
Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, _
ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Dim path$, nIcon As Long
Private Sub Command1_Click()
Dim hIcon As Long
hIcon = ExtractIcon(App.hInstance, path$, nIcon)
Set Picture1.Picture = LoadPicture("") ' Clear the picture box
Picture1.AutoRedraw = True
Call DrawIcon(Picture1.hdc, 0, 0, hIcon)
Picture1.AutoRedraw = False
Picture1.Refresh
nIcon = nIcon + 1
End Sub
Private Sub Form_Load()
' Store the full path to the file containing the icon(s).
path$ = Space$(MAX_PATH)
Call GetSystemDirectory(path$, MAX_PATH)
path$ = Trim$(path$) ' Trim trailing blanks & Null terminator
path$ = Left$(path$, Len(path$) - 1) & "Shell32.dll"
nIcon = 0
End Sub
Listview - Icons
hello folks,
for my latest project I am working on iw ould like to have a listview (reportstyle) with several items in it. For a more "spreadsheet-like-look" I have the gridlines on.
What I would like to do now is to indicate with an icon what item the user selected. So when the user clicks an item a little arrow-like icon appears before in front of the selected line and the icon disappears on the item that was previously selected.
I was thinking to first remove all the markers and then place a marker on the selected item (this because I don't know a method to check the previously selected Item)
for code I have this:
Code:
Private Sub lsvContracts_Click()
Dim NrOfItems As Integer
'remove marker from previous selected item
NrOfItems = lsvContracts.ListItems.Count
For i = 1 To NrOfItems
lsvContracts.ListItems(i).SmallIcon = 0 'no marker should displayed
Next i
lsvContracts.Refresh
'put marker before selected Item
lsvContracts.SelectedItem.SmallIcon = 2
End Sub
this just doesn't seem to be working, I just don't know what to do next.
Does anybody have an Idea how to solve this!!
Listview Icons
I have icons on a listview but I cant get them to line up beside the listitems :
code:
ListView1.View = lvwReport
ListView1.ColumnHeaders.Add , , "Total Users"
ListView1.ColumnHeaders.Add , , "Members"
For UserLoop = LBound(Usernames) To UBound(Usernames)
Set itmX = ListView1.ListItems.Add(, , Usernames(UserLoop))
ListView1.ListItems.Add , , LivveIcon, , 1
Set itmX = Nothing
Next
Can someone plz help?
Icons In Listview
how can i add an icon in a listview. I've searched the forum already and i have to set the imagelist first in the properties, but they are all empty and i dont know how to add something in it. So can anyone help me with this please, how to put the icons in it, and what to do next from there.
Listview Icons
Hi Everyone,
I have a list view box and I would like to place an Icon on each line.
The list view has subitems so it needs to be viewed in the Report View format.
Any ideas?
BDS
>>> ListView And Icons <<<
Hello, all together!
My problem is that:
When I select an entry with an icon of a ListItem control, the icon is/was selected, too. How can I avoid now, that the icon is selected?
Thanks for Help, Marco.
Listview Icons
i have this code to put as icon in my listview
Code:
ListView1.ListItems.Add() = Text1.Text
ListView1.Icons = ImageList1.ListItems
but it doesn't work.Because is the first time i use this property i don't know nothing so i want help as much as you can
ListView Icons
I'm displaying different types of data in a ListView control. Some data types have icons, some do not. All the data with icons are displayed together and all the data without icons are displayed together after the Listview has been cleared. After displaying data with icons, when data is displayed without icons the text stays shifted to the right as if there was still an icon there. Is there a way to move the text back to the left when no icon is displayed? I've tried setting the view to lvwReport or lvwList and refreshing the ListView control but it hasn't worked. Thanks for the help!
ListView + Icons
Hello, it's me again
I have a ListView control returning a transaction history, with succeeded transactions, transaction warnings and transaction errors. Right now, it's just plain text. I would like to put an icon in front of each line, depending on the type off message (Suc., Warn., Err.). Can I do this in my ListView or would you replace it with a grid ?
Greetz,
Yoda
<font color=green>Do or do not
There is no try</font color=green>
ListView Icons
I've added little up and down arrows to indicate how my listview is sorted. What's bugging me is that I cant figure out how to tell a columnheader object that it is to have no icon: i.e. the listview is sorted by another column. How do I de-select an icon in this instance?
Thanks.
ListView Icons
Hello!
I was wondering if it is possible to add images to a ListView controls without needing an ImageList control.
I am re-writing a program which connects to Amazon and downloads CD/DVD covers. If the user enters an unspecific keyword like "Pink Floyd" for example, a lot of images will be returned in the XML file Amazon provides because there are a lot of CDs and DVDs made by Pink Floyd. Let's say 200 images are available. At the moment, the program operates in the following way:
Connect to Amazon and pass subscription ID, keywords, media type...Fetch the "index" XML file Amazon generated and obtain the total number of pages.Loop though all pages and for each page, loop trough the items and look if an image is available. If an image is available, store the URL in an array.Terminate the connection.If the image URL array is not empty, loop through the array and download all files. After each image was downloaded, load it into the ImageList control.After the ImageList control is full of images, start another loop which adds items to the ListView and connect the ImageList with the ListView so the images appear as thumbnails.As you can see, there are a lot of loops there. While the loops in step 3 cannot be avoided (since I have to loop through all pages and all items of the individual pages), I was wondering if I can somehow avoid the other loops by directly adding an item to the ListView and load an image from the disk (rather than from an ImageList).
Any idea if this is possible?
Regards,
Sebastian
|