Jump to content
Xtreme .Net Talk

gstefan

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by gstefan

  1. Good Luck !!!!
  2. I`ve just found the solution to this problem this morning. You need to get a handle of the system image list with SHGetFileInfo (more information in MSDN), and force the listview to get the imagelist from the system image list handle with SendMessage and LVM_SETIMAGELIST it shoul look something like this: .... private System.Windows.Forms.ListView lstViewLeft; IntPtr hImgSmall; //the handle to the system image list SHFILEINFO shinfo = new SHFILEINFO(); //SHFILEINFO is not defined if you use C# like me // //set the listview imagelist to system`s image list (1 is for SmallImageList) SendMessage(this.lstViewLeft.Handle, LVM_SETIMAGELIST, 1 ,(UInt32)hImgSmall); //and then get the icon index on every file you want with SHGetFileInfo(FilePath, 0, ref shinfo,(uint)Marshal.SizeOf(shinfo),SHGFI_SYSICONINDEX | SHGFI_SMALLICON ); the item you add in the imagelist hould hade the image index shinfo.iIcon I`me just cutting and pasting code from my program so search for help on the methods and data structures yourself to understand how they work. If you don`t use the system imagelist I don`t know any other way to get the icons that are not distorted.
×
×
  • Create New...