How to get the icon from a File?

Sprog

Member
Joined
Jul 24, 2006
Messages
24
Location
Patras, Greece
Programming Experience
3-5
I try to create a dialog that ask for replace two files with the same name. As you must have seen, in winxp, there is the icon of the two file on the left of the information.
1. How can i get the icon of a .doc; .mp3; .exe etc, and use it as an image of a picturebox (size 48x48)?
2. Can i maybe show the replace dialog using an API?

Please answer as soon as possible!
 
use the code where they say " 'Use this to get the large icon." in the code
 
I did a search for 48x48 icon and found you have to use a method SHGetImageList instead, this isn't as straight forward as SHGetFileInfo because this method isn't loaded by default from Shell32.dll and you have to do this yourself, also it requires that you define the IImageList interface which is some work, which also means you have to work with different unmanaged Imagelist functions. I haven't found any VB.Net code but there is C# example here.
 
Back
Top