Article View: borland.public.cppbuilder.internet.web
Article #40Re: capture maps
From: Brian
Date: Mon, 31 Mar 2008 18:13
Date: Mon, 31 Mar 2008 18:13
40 lines
2454 bytes
2454 bytes
> Using TCppWebBrowser I made an application to show Google Maps or
> Microsoft Virtual Earth.
>
> Now I'm looking for a way to capture those maps in a jpeg.
>
I did this a while ago (if I remember correctly, I owe Remy a credit or two):
TComInterface<IHTMLDocument2> Doc;
TComInterface<IHTMLStyle> Style;
TComInterface<IHTMLElement> Body;
TComInterface<IHTMLBodyElement> BodyElement;
TComInterface<IViewObject> ViewObject;
{ if(SUCCEEDED(web->Document->QueryInterface(IID_IHTMLDocument2,(LPVOID*)&Doc)))
{ if(SUCCEEDED(Doc->get_body(&Body)))
{ if(SUCCEEDED(Body->QueryInterface(IID_IHTMLBodyElement,(LPVOID*)&BodyElement)))
{ BodyElement->put_noWrap(VARIANT_TRUE);
// hide scrollbars
if( SUCCEEDED(Body->get_style(&Style)))
Style->put_borderStyle(WideString("none"));
BodyElement->put_scroll(WideString("no"));
web->Document->QueryInterface(IID_IViewObject,(LPVOID*)&ViewObject);
if(ViewObject)
{ RECT SourceRect=Rect(0,0,web->Width,web->Height);
Graphics::TBitmap *bitmap=new Graphics::TBitmap;
bitmap->PixelFormat=pf32bit;
bitmap->Height=web->Height;
bitmap->Width=web->Width;
if(SUCCEEDED(ViewObject->Draw(
DVASPECT_CONTENT,1,NULL,NULL,
this->Handle,bitmap->Canvas->Handle,
(_RECTL *) &SourceRect, NULL, NULL,0)))
{ ...
delete bitmap;
}
}
}
}
}
}
Technical Details
Message-ID:
<2f97fdd08a398ca61482f0b0c0e@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!ecngs!feeder.ecngs.de!news.isoc.lu!newsgroups.borland.com!not-for-mailReferences:
<47da62f1$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,13b4c6a9d6acfeb7 X-Google-Attributes: gidfeeec,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 31 Mar 2008 18:13:45 +0000 (UTC) Message-ID: <2f97fdd08a398ca61482f0b0c0e@newsgroups.borland.com> From: Brian <brian@nospam.net> Subject: Re: capture maps Newsgroups: borland.public.cppbuilder.internet.web References: <47da62f1$1@newsgroups.borland.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=iso-8859-1; format=flowed X-Newsreader: JetBrains Omea Reader 1098.1 NNTP-Posting-Host: 168.127.162.105 X-Trace: newsgroups.borland.com 1206987223 168.127.162.105 (31 Mar 2008 11:13:43 -0700) Lines: 42 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!ecngs!feeder.ecngs.de!news.isoc.lu!newsgroups.borland.com!not-for-mail