Re: Capture non-foreground form [GDI-basics]

Tech-Archive recommends: Fix windows errors by optimizing your registry



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
----------------------------------------------------------------------


.



Relevant Pages

  • Problem with redrawing a window after PrintWindow
    ... I'm using the API method PrintWindow to capture a bitmap of a window ...
    (microsoft.public.vb.winapi)
  • SixFiles Best Mac OS X Freebies
    ... The latest Mac OS X freeware software news from Mac.SixFiles.com. ... The Image Browser window is split into two sections. ... screentabular display in an overview windowdisplay in the menu-bardisplay ... * Capture Me 1.3.2 ...
    (comp.sys.mac.apps)
  • Re: SixFiles Best Mac OS X Freebies
    ... The Image Browser window is split into two sections. ... authenticated open and saves, command-line utility, .Mac synchronisation, ... screentabular display in an overview windowdisplay in the menu-bardisplay ... * Capture Me 1.3.2 ...
    (comp.sys.mac.apps)
  • Re: Right-click causes crash in OE 6
    ... If you get the IE Error Reporting Tool window you can click ... on the Click here button and capture the Error Signature on ... by starting drwtsn32 or you may find an Event log entry in Event ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: using CClientDC::BitBlt() to capture only the client window
    ... It doesn't appear that you are restricting the capture area to your client window. ... update the bitmap and then refill the client area with that bitmap. ...
    (microsoft.public.vc.mfc)