Loading the correct icons
-
Hi, I am trying to make a custom treeview in C++ to display the shell's namespace. It works great for all folders except physical drives and remote or network folders. I can't get the correct icons for these folders. I am using the following code snippet to load the icons for the specified folder: (Only need to obtain the icon index) //Retrieve the icon closed for the folder if(SHGetFileInfo((LPCSTR)lpItemIDList1,0,&fileInfo,sizeof(SHFILEINFO),SHGFI_PIDL|SHGFI_SMALLICON|SHGFI_SYSICONINDEX)==NULL) { lpMalloc->Free(lpItemIDList1); lpEnumIDList->Release(); if(lpSubFolder) { lpSubFolder->Release(); } return FALSE; } lpTreeNode->ImageIndex=fileInfo.iIcon; //Retrieve the icon opened for the folder if(SHGetFileInfo((LPCSTR)lpItemIDList1,0,&fileInfo,sizeof(SHFILEINFO),SHGFI_OPENICON|SHGFI_PIDL|SHGFI_SMALLICON|SHGFI_SYSICONINDEX)==NULL) { lpMalloc->Free(lpItemIDList1); lpEnumIDList->Release(); if(lpSubFolder) { lpSubFolder->Release(); } return FALSE; } lpTreeNode->SelectedIndex=fileInfo.iIcon; The pointer lpItemIDList1 points to a piddle that contains the absolute location of the specified folder. (Relative to the root aka desktop folder) I am only trying to display folders. Thanks :)