void __fastcall TForm1 :: GetDriveTree (String DriveName) {SHFILEINFO shfinfo; TTreeNode * Node1 = TreeView1-> Items-> Add (NULL, DriveName); ImageList1-> Handle = SHGetFileInfo (DriveName.c_str (), NULL, & shfinfo, sizeof ( SHFILEINFO), SHGFI_SMALLICON | SHGFI_SYSICONINDEX); Node1-> ImageIndex = shfinfo.iIcon; Node1-> SelectedIndex = shfinfo.iIcon; TSearchRec sr; if (FindFirst (DriveName "* *.", faAnyFile, sr) == 0) {do {IF ((sr.attr & fadirectory && sr.name! = "." && sr.name! = ")) {Str.name; ttreenode * tempnode = treeview1-> items-> AddChild (Node1, sr.Name); ImageList1-> Handle = SHGetFileInfo (temp.c_str (), NULL, & shfinfo, sizeof (SHFILEINFO), SHGFI_SMALLICON | SHGFI_SYSICONINDEX); TempNode-> ImageIndex = shfinfo.iIcon; TempNode-> SelectedIndex = Shfinfo.ily (FindNext (SR) == 0); FindClose (SR);} TreeView1-> SELECTED = TreeView1-> getNodeat (1, 1); // Let him say a changing} // set the ListView icon after the update is finished. SHFILEINFO FileInfo; THandle ImageListHandle; // large icons ImageListHandle = SHGetFileInfo ( "C: //", 0, & FileInfo, sizeof (FileInfo), SHGFI_SYSICONINDEX | SHGFI_LARGEICON); SendMessage (FJListView-> Handle, LVM_SETIMAGELIST, LVSIL_NORMAL, ImageListHandle); SendMessage (FJHtmlListView-> Handle, LVM_SETIMAGELIST, LVSIL_NORMAL, ImageListHandle); // small icons ImageListHandle = SHGetFileInfo ( "C: //", 0, & FileInfo, sizeof (FileInfo), SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
SendMessage (fjlistview-> handle, lvm_setimagelist, lvsil_small, imagelisthandle); sendMall (FjhtmllistView-> Handle, LVM_SetImageList, Lvsil_Small, ImageListHandle; SHFILEINFO FILEINFO;
ZeromeMory (FileInfo); SHGETFILEINFO (sfilename.c_str (), 0, & fileinfo, sizeof (fileInfo), shgfi_icon | shgfi_smallicon;
The reason is only if you didn't set imagelist1 ShareImages to True ...
SendMessage (fjlistview-> handle, lvm_setimagelist, lvsil_small, imagelisthandle); sendMessage (fjhtmllistview-> handle, lvm_setimagelist, lvsil_small, imagelisthandle);
SHFILINFO FILEINFO;
ZeromeMory (FileInfo); SHGETFILEINFO (sfilename.c_str (), 0, & fileinfo, sizeof (fileInfo), shgfi_icon | shgfi_smallicon;
The reason is only if you didn't set imagelist1 ShareImages to True ...