Solved

Capturing Desktop's Screen

Posted on 2001-07-15
12
410 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
RIA: CancelEdit() doesn't change entity back to Unchanged status 5 34
Example of WebAPI 7 33
Please explain "Multi-Tenant Services" 5 85
VS2015 Redefinition errors 4 52
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 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