Retrieve icon image of files

Is there a way to get the icon image of a file? Especially media files that shows a representation of the movie.

For OSX there are several ways doing this but I cannot find to do this with Windows (MBS plugins cannot do this - as far as I know)

MBS can get the icons:

Component: QuickLook
Mac OS X: Yes
Windows: Yes

but what you are seeing may not be the icon… it may be a windows preview, such as they give in explorer to photographs?
(Its an optional setting in Windows)
You may need to down and dirty with Thumbs.db which in theory holds the thumbnail images in OLE format

Yes, I need the preview. But it only works with OSX. Windows returns NIL.

I would ask Christian first.

folderitem.IconMBS and folderitem WinThumbnailMBS may work.

Long time ago, I created a project (bad coding) that extracted the icons from a Thumbs.db file.

I assumed these are jpg files (assumption done by reverse engineering), and so I computed the start byte of the next icon, decoding the current one, saving it and loop to the beginning until no more jpg icon was available in the Thumbs.db file.
I forgot how I computed the icon size in bytes (used to determine the icon size in bytes in the Thumbs.db file). I may used a different way (like the file name ?). My memory fails here.

I do not have archive for these days (1997-2002) and I do not recall the “then” purpose.

I would prefer using official API and not relay on a specific file format.
maybe check WinThumbnailMBS function?

This is what worked fine. Thanks

For those that are interested, here is the code that I have to accomplish this:

[code]Public Function GetIcon(extends f as folderitem) as picture
// make an icon with mask from the file

dim m,p as Picture
dim q as Picture


q=New Picture(16,16,32)
q.Graphics.DrawPicture p,0,0
q.Mask.Graphics.DrawPicture m,0,0

Return q

End Function
NOTE: This still uses MBS, but this works really well and makes sure that if there is any transparency in the icon it is preserved.

Why don’t you use IconMBS which gives you image with mask or alpha?
So you don’t need to build it yourself?