Eric wrote:
Hi, I we would be very interested in this functionnality!!!
I've implemented a bit of a (sleazy) hack to render Mozilla into a bitmap
(from a non-visible window) under Win32, and thought I'd share (for what it's
worth). The algorithm goes like this:
1. Have your nsIWebProgressListender set a flag when loading is complete (i.e.
STATE_STOP && STATE_IS_DOCUMENT). You'll have to give the browser a chance to
display itself, which is why you set a flag and check it later (there may be
timing issues with this approach).
2. Create an appropriate GDI bitmap (i.e. same size as window), and grab a
device context to it. I'm using Gdiplus, which looks like:
Gdiplus::Bitmap Img( Width, Height, PixelFormat32bppRGB );
Gdiplus::Graphics Painter( &Img );
HDC DC = Painter.GetHDC();
3. Given an HWND to the browser window (e.g. "Win"), traverse the window tree
to find the lowest-level window. Note that this seems to change, so you'll
need to do it each time:
HWND PaintWin, Child = Win;
while ( Child = GetWindow( Child, GW_CHILD ) )
PaintWin = Child;
4. Send a WM_PRINTCLIENT message to this child window, specifying the DC of
the bitmap you created in #2:
SendMessage( PaintWin, WM_PRINTCLIENT, (WPARAM) DC, PRF_CLIENT |
PRF_CHILDREN );
5. In my case, I need to copy the pixel data from the GDI bitmap to a
DirectShow frame. If you need access to the raw bitmap data, you can get it with:
Rect r( 0, 0, Img.GetWidth(), Img.GetHeight() );
BitmapData Buff;
Img.LockBits( &r, ImageLockModeRead, PixelFormat32bppARGB, &Buff );
// Buff.Scan0 now points to pixel bits
Img.UnlockBits( &Buff );
Hope this is of some use to someone ... ;)
-- Steve
_______________________________________________
mozilla-embedding mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-embedding