Solved

Capturing Desktop's Screen

Posted on 2001-07-15
12
408 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

759 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

20 Experts available now in Live!

Get 1:1 Help Now