Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Capturing Desktop's Screen

Posted on 2001-07-15
12
Medium Priority
?
417 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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
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…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 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