Re: Capture non-foreground form [GDI-basics]
- From: "Thorsten Albers" <albersRE@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 13 Jun 2006 03:05:57 -0700
Alexander Mueller <millerax@xxxxxxxxxxx> schrieb im Beitrag
<#D9wmOTjGHA.4284@xxxxxxxxxxxxxxxxxxxx>...
Can I capture a hidden form (Visible = false)
Can I capture a form that is not in foreground,
i.e. that is completely covered by another form
Can i capture a form that is 'outside the screen' (moved outside the
visible area of the monitor)
It completely depends on how the respective applications performs painting
of the contents of its windows. E.g. there may be an application which
paints the contents of one of its windows (or part of it) only if the
respective window is (at least partly) visible.
And it depends also on device context usage: If one window covers another,
and if both windows are using the same device context you can't capture the
contents of the covered window.
But you can try this:
- Create a DC which is compatible to the DC of the source window you would
like to capture
(CreateCompatibleDC())
- Create a bitmap which is compatible to the DC of the source window and
the size of which at least matches the size of the client area of the
source window
(CreateCompatibleBitmap())
- Select the created bitmap into the created DC
- Send a WM_PRINTCLIENT message to the source window providing the created
DC as the WPARAM; if you are lucky, the source window then will paint its
context to the created bitmap
If never tested this...
Another approach (just a thought...):
- Walk from the bottom most to the top most window which you would like to
capture
- Before trying to capture it call InvalidateRect() with the parameter
"hWnd" set to the handle of the respective window, with the parameter
"lpRect" set to NULL, and with the parameter "bErase" set to TRUE; this
'fills' the update region of the respective window
- Following this immediately call UpdateWindow() for the respective window;
this will send a WM_PAINT message directly to the window procedure and not
to the application message queue.
If never tested this as well...
There of course may be an easier solution to the problem but
unfortunately none is known to me. And it is not for sure that what is
given above is a solution...
--
----------------------------------------------------------------------
THORSTEN ALBERS Universität Freiburg
albers@
uni-freiburg.de
----------------------------------------------------------------------
.
- Prev by Date: Re: Capture non-foreground form [GDI-basics]
- Next by Date: Re: Capture non-foreground form [GDI-basics]
- Previous by thread: Re: Capture non-foreground form [GDI-basics]
- Next by thread: Re: Capture non-foreground form [GDI-basics]
- Index(es):
Relevant Pages
|