Article View: borland.public.cppbuilder.internet.web
Article #1491CppWebBrowser IViewObject->Draw only black and white?
From: Timon Meyer
Date: Wed, 10 Nov 2004 11:33
Date: Wed, 10 Nov 2004 11:33
44 lines
2205 bytes
2205 bytes
Hello,
I used the IViewObject interface I got from CppWebBrowser and used the
IObjectView->Draw function to capture the content of CppWebBrowser into a
bitmap. Everything seems to work but the HTML content of the CppWebBrowser
is rendered only black and white!?!
Here is what I did:
... standard code here to get the pDoc of CppWebBrowser ...
IViewObject* pViewObject;
pDoc->QueryInterface(IID_IViewObject, (void**)&pViewObject);
if (pViewObject)
{
HDC hDCMem = CreateCompatibleDC(NULL); // For destination bitmap
HBITMAP hBmp = NULL;
HDC hScreenDC = ::GetDC(CppWebBrowser1->Handle);
hBmp = CreateCompatibleBitmap(hDCMem, rcSource.right - rcSource.left,
rcSource.bottom - rcSource.top);
::ReleaseDC(CppWebBrowser1->Handle, hScreenDC);
HGDIOBJ hOld = SelectObject(hDCMem, hBmp);
hr = pViewObject->Draw( DVASPECT_CONTENT, -1, NULL, NULL,
hScreenDC, hDCMem, &rcSource,
NULL, NULL, 0);
pViewObject->Release();
SelectObject(hDCMem, hOld);
DeleteObject(hDCMem);
OpenClipboard(Form1->Handle);
EmptyClipboard();
SetClipboardData(CF_BITMAP, hBmp);
CloseClipboard();
}
After I execute the code I get only a black and white version of the HTML
content in the clipboard,
does anybody know why?
Thanks for any help!
Technical Details
Message-ID:
<4191fc74@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!newsfeed.icl.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: feeec,f0ee9b75b39ceda2,start X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Timon Meyer" <timon@mustek.de> Newsgroups: borland.public.cppbuilder.internet.web Subject: CppWebBrowser IViewObject->Draw only black and white? Date: Wed, 10 Nov 2004 12:33:04 +0100 Lines: 46 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: 80.132.179.78 Message-ID: <4191fc74@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1100086388 80.132.179.78 (10 Nov 2004 03:33:08 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!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