Solved

Capturing Desktop's Screen

Posted on 2001-07-15
12
413 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…

734 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