ShellBrowser Delphi Components Documentation
ContentsIndexHome
PreviousUpNext
Jam.Shell.Thumbnail.TJamThumbnailExtractor.GetThumbnailAsImage

Retrieves the thumbnail of a file and assigns it to the passed TImage.

Syntax
Pascal
class function GetThumbnailAsImage(const pItemIdList: IItemIdList; pImage: TImage): Boolean;
Parameters 
Description 
const pItemIdList: IItemIdList 
The ItemIdList to get the image for. 
pImage: TImage 
This argument receives the thumbnail if it could be assigned successfully.  

true if the thumbnail was generated successfully, false otherwise.

GetThumbnailAsImage generates a thumbnail of the current file and assigns it to the Image that was passed as argument. The size of the generated Thumbnail may be adjusted using the Width and Height property of the Image.  

Note, that only real thumbnails are retrieved using this function, no file icons. ThumbnailHandler shell extensions must be available for handling the specific file type This is usually the case for common file types like GIF or JPEG files, but may be not the case for more exotic formats.  

If you call this function from a thread, COM must be initialized using CoInitializeEx(). For informations about CoInitializeEx() see: https://docs.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-coinitializeex.

The following code generates a thumbnail for the file in the variable AbsoluteItemIdList. If the thumbnail could not be generated, the image is made invisible.

Image.Visible := not TJamThumbnailExtractor.GetThumbnailAsImage(AbsoluteItemIdList, Image);