Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BitBlt articel ID 161299 (How To Capture and Print ..) 2 screen p

5 views
Skip to first unread message

powerzumsel

unread,
Nov 10, 2008, 3:59:00 AM11/10/08
to
Hi

maybe sb can help me in this case

Trying to get a screenshot of the entire display screen i found a lot of
code to do so in the internet.
With little changes the way of proceeding is nearly the same as in this
article "How To Capture and Print the Screen, a Form, or Any Window" ID 161299

So tried this on my own.

I also want to get a screenshot of all attached displays. So I first run
EnumDisplayMonitors.
EnumDisplayMonitors offers every display so I run its CallBack severals
times with different values (DISPLAY1 , DISPLAY2...)
In its callback function I get the display name (e.g. \\.\DISPLAY1) and
the display RECT information

With this info I run a slightly modified "CaptureWindow" (from article) in
which I get the Divice Contaxt (DC) from the specified screen with
"hDCSrc=createDC (\\.\DISPLAY1, 0,0,0) instead of
hDCSrc=GetWindowDC(GetDesktopWindow)

Then I just use the article function to build and prepare bmp and memory
space (e.g. CreateCompatibleBMP)


Then I use BitBlt in this way:
BitBlt(hDCMemory, 0, 0, WidthSrc, HeightSrc, hDCSrc, 0, 0, vbSrcCopy)

I use 0=xSrc and 0=ySrc becaus I read somewhere that every display got its
own origin


Then I save the Bmp


Now the strange thing starts:

When I start my app on a single display PC, I get one bmp containing the
desktop screenshot

when i start my app I get 2 bmps. First one contains screenshot of main
display ("1" in display settings (right click on desktop)), second one
contains screenshot of 2.display ("2") .Fine so far

but when I try to start it on a remote PC with psexec (psexec //REMOTEPC -u
Admin -p password "C:\Myapp.exe")
I just get a black filled BMP
On a two-display PC I just get again a bmp with a black box from display 1
but the BMP from display 2 is filled with the desktop screenshot, wierd!


Maybe sb knows that problem and can help me

thank you

expvb

unread,
Nov 10, 2008, 12:37:24 PM11/10/08
to
Try running psexec with -i option.

Also, search the newsgroups for "secure desktop". It's a feature in Windows
2000+, when the screen saver is active or the workstation is locked, GDI
functions fail and you typically get black screen.


0 new messages