How to retrieve the file previews used by windows explorer in Windows vista and seven?
Asked Answered
W

2

5

I am developing a Delphi documents management application, so somehow I am giving the user some functionality similar to windows explorer.

I would like to know if there is a way to get the preview used by windows explorer. For example windows explorer creates a small thumbnail for a pdf document for example, and displays it when the user chooses to view "big icons". Is there a way to retrieve that preview?

MyTImage := GiveMePreviewForFile('C:\Test\File.pdf');
Wien answered 26/5, 2010 at 9:55 Comment(2)
Possible dupe (first question): #830343Trial
Sorry you are right. I reformulated the question. Thanks.Wien
B
9

@user193655, using the IExtractImage interface is the way to go, this interface exposes methods that request a thumbnail image from a Shell folder

you can find a very complete sample in this site and the source code is here.

check this image

alt text

Binni answered 26/5, 2010 at 20:38 Comment(4)
At the moment, the source code can still be downloaded from archive.org: web.archive.org/web/20060115070800/http://www.delphi3000.com/…Casebound
Note that the code above from Hans Gulo works, but is very slow, taking around 500 to 1000 ms :-( The slowness occurs when calling the Extract function on line 24 of ShObjIdlQuot.pas.Colossae
Both Hans and Microsoft mention that you can call Kill to abort the process, but it's not clear how to do that or whether you still get a result.Colossae
To use Hans Gulo's code in a thread, you must first initialize the COM engine by calling CoInitialize(), then free it by calling CoUninitialize();Colossae
O
2

Take a look at the docs for IExtractImage. Basically you use IShellFolder with IExtractImage to get the picture you are looking for.

Oshaughnessy answered 26/5, 2010 at 13:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.