Solved

Capturing Desktop's Screen

Posted on 2001-07-15
12
409 Views
Last Modified: 2013-12-03
Hi,
I write an application that at a certain point needs to capture the desktop screen and to hold its bitmap
(for further editing).
My problem is to snag DirectX, Direct3D games and DVDs (etc.) windows.
Trying to do this by the GDI api's result in dark rectangles where those windows supposed to be.
If anyone has an idea how to solve the problem I'll be thankful.
0
Comment
Question by:GuyK
  • 4
  • 3
  • 3
  • +1
12 Comments
 
LVL 5

Expert Comment

by:robpitt
ID: 6283388
In the registry under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectDraw
set the DWORD value called "EnablePrintScreen" and set it to 0 or 1 (create the value if necessary).

This will at least allow the PrintScrn key to work with DirectDraw (and D3D as well I think). It may well also allow your code to work.

NOTE:
If you change the value within your program, then I thinnk you should restore it on exit. I believe the setting is off by default because it can hamper performance in some configurations (maybe).

Rob
0
 

Author Comment

by:GuyK
ID: 6283424
Sorry but nop...
0
 
LVL 1

Expert Comment

by:mcsilver
ID: 6284011
Microsoft has an article on doing this in VB, but it uses the Windows API, so you could convert it to C/C++ code if you wanted.
0
 
LVL 1

Expert Comment

by:mcsilver
ID: 6284013
0
 

Author Comment

by:GuyK
ID: 6284866
mcsilver  - Thanks for the answer but...
My problem is capturing the streaming frames (mpg, dvds etc.). Bitblt, by bliting from the sysetm memory, wouldn't help me. What would have helped me is a special Bitblt that access the display device memory (and by that copy the actual bits that appear on the screen).
I suppose that the problem lays on the fact that streaming devices (video, mpg decoder etc.) have direct access to the display device and do not use the system memory.
My only way out of this problem is using DirectX interfaces but I have tried to avoid it because no one guarantees DirectX exist on any computer.
0
 
LVL 5

Accepted Solution

by:
robpitt earned 120 total points
ID: 6285139
Once you have a non-exclusive directdraw interface you should be able to blt from a video surface memory to an offscreen buffer.

If you went for DirectX 3 interfaces it wouldn't be so bad as this is included on all windows versions except the original Win95. However for some reason MS have retired all their old SDKs so even finding DX3 documentation is difficult.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Expert Comment

by:mite51
ID: 6287903
I know how to do it but I can't tell you. Well I could, but then I would have to kill you :P
0
 
LVL 1

Expert Comment

by:mcsilver
ID: 6287917
So this doesn't do what you want (it doesn't access the display memory)?

hDC = CreateDC("DISPLAY", NULL, NULL, NULL);

0
 
LVL 1

Expert Comment

by:mite51
ID: 6287920
that work on win 9x but not windows 2k. or was it the other way around?
0
 

Author Comment

by:GuyK
ID: 6288720
I'm working on win 2k and that does not work on it.
I doubt if it works on win 9x.
I've managed to do it using DirectDraw (of DirectX).
Using DD surface's Lock(...) enables you to access screen's actual bits.
0
 
LVL 5

Expert Comment

by:robpitt
ID: 6288918
Note for maximum compatiblity, be sure to use the basic DirectDraw v1 interfaces i.e. DirectDrawCreate().

DirectX1 should be available on virtual all windows versions as it is included with all windows except the original Win95 and it's also included with Internet Explorer 4 and later.
0
 

Author Comment

by:GuyK
ID: 6288924
Thanks 4 the advice...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now