🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #1665

Re: TCppWebBrowser and CaptureThumbnail

#1665
From: Remy Lebeau (TeamB)
Date: Tue, 24 Aug 2004 07:28
43 lines
2223 bytes
"Lapo Guidi" <lapoguidi@inwind.it> wrote in message
news:412a9c86@newsgroups.borland.com...

> Somebody can help me on using the buil-in CaptureThumbnail
> defined in shlobj.h to save a jpg thumbnail of a loaded html
> document inside a TCppWebBrowser?

    #include <utilcls.h>
    #include <mshtml.h>
    #include <memory>
    #include <jpeg.hpp>

    if( CppWebBrowser1->Document )
    {
        TComInterface<IHTMLDocument2> Doc;
        if(
SUCCEEDED(CppWebBrowser1->Document->QueryInterface(IID_IHTMLDocument2,
(LPVOID*)&Doc)) )
        {
            SIZE size = {100, 100};    // use whatever dimensions you
want...
            HBITMAP hThumb = NULL;
            TComInterface<IThumbnailCapture> Thumb;

            // sorry, I don't know how to obtain the actual
            // IThumbnailCapture instance, someone else
            // will have to help you with that part...

            if( SUCCEEDED(Thumb->CaptureThumbnail(&size, Doc, &hThumb)) )
            {
                std::auto_ptr<Graphics::TBitmap> Bmp(new Graphic::TBitmap);
                Bmp->Handle = hThumb;

                std::auto_ptr<TJPEGImage> Jpg(new TJPEGImage);
                Jpg->Assign(Bmp.get());
                // use Jpg as needed...
            }
        }
    }


Gambit
Technical Details
Message-ID: <412aedc2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <412a9c86@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,9c51eda80d523333
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.internet.web
References: <412a9c86@newsgroups.borland.com>
Subject: Re: TCppWebBrowser and CaptureThumbnail
Date: Tue, 24 Aug 2004 00:28:08 -0700
Lines: 45
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <412aedc2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1093332418 68.69.17.41 (24 Aug 2004 00:26:58 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail