Page 1 of 1

Desktop Duplication API (IDXGIOutputDuplication)

Posted: Sun May 25, 2014 4:14 pm
by atomo
Hi,

I'm trying to use the IID_IDXGIOutputDuplication Interface to get an image of my desktop on Windows 8 but i can't find the CLSID and IID to use with CoCreateInstance.
Help needed please, i'm totaly noob with COM :oops:
Here is what i have already done :

Code: Select all

Structure DXGI_RATIONAL
  Numerator.i
  Denominator.i
EndStructure

Structure DXGI_MODE_DESC
  Width.i
  Height.i
  RefreshRate.DXGI_RATIONAL
  Format.i
  ScanlineOrdering.i
  Scaling.i
EndStructure  

Structure DXGI_OUTDUPL_POINTER_POSITION
  Position.POINT
  Visible.b
EndStructure  
  
Structure DXGI_OUTDUPL_DESC
  ModeDesc.DXGI_MODE_DESC
  Rotation.i
  DesktopImageInSystemMemory.b
EndStructure

Structure DXGI_OUTDUPL_FRAME_INFO
  LastPresentTime.q
  LastMouseUpdateTime.q
  AccumulatedFrames.i
  RectsCoalesced.b
  ProtectedContentMaskedOut.b
  PointerPosition.DXGI_OUTDUPL_POINTER_POSITION
  TotalMetadataBufferSize.i
  PointerShapeBufferSize.i
EndStructure

Structure DXGI_OUTDUPL_MOVE_RECT
  SourcePoint.POINT
  DestinationRect.RECT
EndStructure

Structure DXGI_OUTDUPL_POINTER_SHAPE_INFO
  Type.i
  Width.i
  Height.i
  Pitch.i
  HotSpot.POINT
EndStructure

Structure DXGI_MAPPED_RECT
  Pitch.i
  *pBits
EndStructure

Interface IDXGIResource
  GetEvictionPriority(*pEvictionPriority)
  GetSharedHandle(*pSharedHandle)
  GetUsage(*pUsage)
  SetEvictionPriority(EvictionPriority.i)
EndInterface

Interface IDXGIOutputDuplication
  GetDesc(*pDesc.DXGI_OUTDUPL_DESC)
  AcquireNextFrame(TimeoutInMilliseconds.i, *pFrameInfo.DXGI_OUTDUPL_FRAME_INFO, *ppDesktopResource.IDXGIResource)
  GetFrameDirtyRects(DirtyRectsBufferSize.i, *pDirtyRectsBuffer.RECT, *pDirtyRectsBufferSizeRequired)  
  GetFrameMoveRects(MoveRectsBufferSize.i, *pMoveRectBuffer.DXGI_OUTDUPL_MOVE_RECT, *pMoveRectsBufferSizeRequired)  
  GetFramePointerShape(PointerShapeBufferSize.i, *pPointerShapeBuffer, *pPointerShapeBufferSizeRequired, *pPointerShapeInfo.DXGI_OUTDUPL_POINTER_SHAPE_INFO)
  MapDesktopSurface(*pLockedRect.DXGI_MAPPED_RECT)
  UnMapDesktopSurface()
  ReleaseFrame()
EndInterface

Re: Desktop Duplication API (IDXGIOutputDuplication)

Posted: Sun May 25, 2014 6:37 pm
by Thunder93
IID_IDXGIOutputDuplication would be 191cfac3-a341-470d-b26e-a864f428319c

Re: Desktop Duplication API (IDXGIOutputDuplication)

Posted: Sun May 25, 2014 6:44 pm
by Thunder93
Here is what I came up with..
136 MIDL_INTERFACE("ea9dbf1a-c88e-4486-854a-98aa0138f30c")

137 IDXGIDisplayControl : public IUnknown

138 {

139 public:

140 virtual BOOL STDMETHODCALLTYPE IsStereoEnabled( void) = 0;

--------------------------------------------------------------------------------

280 MIDL_INTERFACE("191cfac3-a341-470d-b26e-a864f428319c")

281 IDXGIOutputDuplication : public IDXGIObject

282 {

283 public:

284 virtual void STDMETHODCALLTYPE GetDesc(

--------------------------------------------------------------------------------

540 MIDL_INTERFACE("aba496dd-b617-4cb8-a866-bc44d7eb1fa2")

541 IDXGISurface2 : public IDXGISurface1

542 {

543 public:

544 virtual HRESULT STDMETHODCALLTYPE GetResource(



Re: Desktop Duplication API (IDXGIOutputDuplication)

Posted: Tue May 27, 2014 7:45 pm
by atomo
Thanks for the IID, do you know where can i find the CLSID ?