Click to See Complete Forum and Search --> : How does OS display thumbnail image from a file ?
MMH
January 15th, 2009, 07:31 AM
Hi All,
I am writing an application which saves/loads a file having its own file format.
I want to display a thumbnail image of the file content by the OS.
(e.g. as we see Adobe Illustrator file content on saving it)
Can somebody tell me how does the OS display the file content(as file preview)? so that i can write that information while saving to my file.
Just for Info: My application is storing content in binary format.
Thanks a lot....
MMH
cilu
January 15th, 2009, 09:19 AM
It makes a stretch copy using StretchBlt().
MMH
January 15th, 2009, 10:35 PM
It makes a stretch copy using StretchBlt().
Thanks for your reply. But i am not sure this function will solve my problem.
Let me explain my situation in another way:
My application writes a file (*.mha) which OS (Windows) doesn't know how to render and display the file content preview.
For example: in Adobe Photoshop (or vector graphics file like *.ai) OS displays file preview in the Windows Explorer.
Whereas, my file is displayed with the associated icon and not with the content of the saved file.
My application is sort of a designer which saves data in binary format.
So my question is, how does OS read/ render a file to get the file preview? (as commonly seen with movie files - *.avi, *.mpeg, etc)
Do i need to write some information while saving the file from which OS can read and display the content as thumbnail preview?
I hope my problem is clearly explained.
Thanks for the help....
Regards,
MMH
cilu
January 16th, 2009, 02:04 AM
That's a good question. I never thought of that. I suppose that is possible only for document types recognized by the system. But it might be possible that some mechanism exists that allows the OS to query an application for a preview. In this case I bet it's a COM, but I don't know what interfaces you'd have to implement.
BigEd781
January 16th, 2009, 03:10 AM
You can write a shell extension to do this. I have never done it myself, but at work we use a proprietary image format and we have the functionality you are after. I found some info on this site (http://www.codeguru.com/cpp/com-tech/shell/article.php/c4517/), and a search for "windows shell extension" will get you some more. Microsoft recommends against using managed code for this however and they do not consider it a supported practice. This is because the code may be loaded into arbitrary processes and you may get version incompatibilities. It is possible though and you can find some info on it here (http://msdn.microsoft.com/en-us/magazine/cc188741.aspx).
boudino
January 16th, 2009, 03:36 AM
You to register your application with windows shell and implement IThumbnailProvider interface. I've found this article (http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2006/07/21/5884.aspx), but this is for Vista, so maybe it won't be 100% suitable for you.
cilu
January 16th, 2009, 08:17 AM
IThumbnailProvider works only for Visma and Server 2008. For others you need IExtractImage.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.