• Advertisement

Archived

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

how to preview like in windows explorer

This topic is 5996 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
Advertisement
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
ShellEx\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}

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