Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Fri, 04 Jul 2008 10:31:09 +0200,    group: microsoft.public.win32.programmer.directx.graphics        back       


Screen Capture Using DirectX   
Hi Everybody,


I've done a small application that plays video (wmv) full screen using
the standard TMediaPlayer in Delphi 2007.

Now i'm trying to add the code to grab the screen and save it to a BMP
or JPG on local disk every N minutes.

I'm using this code found on internet :

procedure ScreenShot(x : integer; y : integer; Width : integer; Height
: integer; bm : TBitMap);
var
  dc: HDC;
begin
  //test width and height
  if ((Width = 0) OR (Height = 0)) then exit;
  bm.Width := Width;
  bm.Height := Height;

  //get the screen dc
  dc := GetDC(0);

  if (dc = 0) then exit;

  //copy from the screen to the bitmap
  BitBlt(bm.Canvas.Handle,0,0,Width,Height,Dc,x,y,SRCCOPY);


  //release the screen dc
  ReleaseDc(0, dc);
end;

This is very simple but does not work with video. It return a black
screen !

In the last two days I' ve found that the reason of the failure is HW
acceleration of the Video Card. If I disable that function then the
Software works, but obviously i can't disable HW Acceleration.

Someone told me that I have to use DirectDraw / DirectX API because
TMediaPlayer uses overlay but I don't know nothing about this API's

Does anybody have some sample code to do this screen capture function
using directdraw?


Thank you

Luca
date: Fri, 04 Jul 2008 10:31:09 +0200   author:   MaHi

Re: Screen Capture Using DirectX   
[Please do not mail me a copy of your followup]

MaHi  spake the secret code
 thusly:

>This is very simple but does not work with video. It return a black
>screen !

Most video decoders use a hardware video overlay and the data there is
not available to GDI.  If you disable all hardware acceleration of
video playback, you can then obtain the information in GDI.

If you're just trying to grab frames every N minutes from the video
playback, you're probably better off using DirectShow to do this
directly.
-- 
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
      <http://www.xmission.com/~legalize/book/download/index.html>

        Legalize Adulthood! <http://blogs.xmission.com/legalize/>
date: Sun, 13 Jul 2008 12:37:50 -0700   author:   legalize+ (Richard [Microsoft Direct3D MVP])

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us