🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.web
2 messages
2 total messages Started by Timon Meyer Wed, 10 Nov 2004 11:33
CppWebBrowser IViewObject->Draw only black and white?
#1491
Author: Timon Meyer
Date: Wed, 10 Nov 2004 11:33
44 lines
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!
Re: CppWebBrowser IViewObject->Draw only black and white?
#1505
Author: Timon Meyer
Date: Wed, 17 Nov 2004 18:11
4 lines
1142 bytes
I found out that IViewObject has problems with frames, so I decided to stop
the way using IViewObject

Thanks anyway!
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads