Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


how to preview like in windows explorer

This topic is 6177 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was wondering if anyone out there knows how to draw a preview of a file like windows 2000 does in windows explorer. you select a file such as an html doc or a picture and it shows you a thumbnail of the file in the lower left hand corner. right now i'm using CoGetObject to retrieve an IUnknown pointer, but when i QI for IViewObject and call Draw all i get is an empty frame. heres the code i'm using: BIND_OPTS bind; ZeroMemory(&bind, sizeof(bind)); bind.cbStruct = sizeof(bind); bind.grfFlags = BIND_MAYBOTHERUSER; bind.grfMode = STGM_CREATE|STGM_READWRITE; CComPtr spUnk; CoGetObject(L"C:\\pic.jpg", &bind, IID_IUnknown, (void**)&spUnk); CComQIPtr spView(spUnk); if (spView) { spView->Draw(DVASPECT_CONTENT,-1,0,0,0,hdc,&rectl,&rectl,0,0); } the drawing succeeds, but it doesn't actually draw the jpg??? Edited by - Fragmo on November 20, 2001 3:13:44 PM

Share this post

Link to post
Share on other sites
yay, i figured it out

need to dig into the registry

get this HKEY
HKEY_CLASSES_ROOT\.jpg (or whatever file extension you want)

open this subkey

the default value of this key will be the CLSID of a thumbnail extractor object, so do a CoCreateInstance on this and QI for IPersistFile.

call IPersistFile::Load with the file in question

QI for IExtractImage
call IExtractImage::GetLocation to init some crap then
IExtractImage::Extract returns the bitmap

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!