GuyK
asked on
Capturing Desktop's Screen
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.
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.
ASKER
Sorry but nop...
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.
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I know how to do it but I can't tell you. Well I could, but then I would have to kill you :P
So this doesn't do what you want (it doesn't access the display memory)?
hDC = CreateDC("DISPLAY", NULL, NULL, NULL);
hDC = CreateDC("DISPLAY", NULL, NULL, NULL);
that work on win 9x but not windows 2k. or was it the other way around?
ASKER
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.
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.
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.
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.
ASKER
Thanks 4 the advice...
HKEY_LOCAL_MACHINE\SOFTWAR
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