Search the Community
Showing results for tags 'dxgi screencapture'.
-
Hi Folks, i was looking for a fast an reliable way to make screenshots and came across this: https://github.com/pgurenko/DXGICaptureSample https://msdn.microsoft.com/en-us/library/windows/desktop/bb205075(v=vs.85).aspx so far i managed to find the following code on the forum but not more. ;~ #AutoIt3Wrapper_UseX64=y #include <WinAPI.au3> Global Const $DXGI_ERROR_NOT_FOUND = 0x887A0002 Global Const $sTag_DummyIDXGIObject = "Dummy1 hresult();Dummy2 hresult();Dummy3 hresult();Dummy4 hresult();" Global Const $sTag_IDXGIFactory = $sTag_DummyIDXGIObject & "EnumAdapters hresult(uint;ptr*); MakeWindowAssociation hresult(hwnd;uint); GetWindowAssociation hresult(hwnd*); CreateSwapChain hresult(ptr;ptr;ptr*); CreateSoftwareAdapter hresult(hwnd;ptr*);" Global Const $sIID_IDXGIFactory = "{7b7166ec-21c7-44ae-b21a-c9ae321ae369}" Global Const $sTag__IDXGIAdapter = $sTag_DummyIDXGIObject & "EnumOutputs hresult(uint;ptr*);GetDesc hresult(ptr);CheckInterfaceSupport hresult(ptr;long)" Global Const $sIID_IDXGIAdapter = "{2411e7e1-12ac-4ccf-bd14-9798e8534dc0}" Global Const $sTag_DXGI_ADAPTER_DESC = "wchar Description[128];uint VendorId;uint DeviceId;uint SubSysId;uint Revision;ULONG_PTR DedicatedVideoMemory;ULONG_PTR DedicatedSystemMemory;ULONG_PTR SharedSystemMemory;DWORD LowPart;LONG HighPart;" DllOpen("DXGI.dll") Local $tRIID_IDXGIFactory = _WinAPI_CLSIDFromString($sIID_IDXGIFactory) Local $aRet = DllCall("DXGI.dll", "long", "CreateDXGIFactory1", "ptr", DllStructGetPtr($tRIID_IDXGIFactory), "ptr*", 0) If @error Or UBound($aRet) <> 3 Then $aRet = DllCall("DXGI.dll", "long", "CreateDXGIFactory", "ptr", DllStructGetPtr($tRIID_IDXGIFactory), "ptr*", 0) If @error Or UBound($aRet) <> 3 Then Exit ConsoleWrite("Unable to get IDXGIFactory Interface Pointer" & @CRLF) EndIf EndIf Local $pIDXGIFactory = $aRet[2] ConsoleWrite("$pIDXGIFactory: " & $pIDXGIFactory & @CRLF) If Not $pIDXGIFactory Then Exit ConsoleWrite("Unable to get IDXGIFactory Interface Pointer" & @CRLF) Local $oDXGIFactory = ObjCreateInterface($pIDXGIFactory, $sIID_IDXGIFactory, $sTag_IDXGIFactory) ConsoleWrite("IsObj($oDXGIFactory): " & IsObj($oDXGIFactory) & @CRLF) Local $pAdapter = 0 Local $oAdapter = 0 Local $i = 0 Local $tApdaterDescription = 0 While Not $oDXGIFactory.EnumAdapters($i, $pAdapter) = $DXGI_ERROR_NOT_FOUND ConsoleWrite("$pAdapter: " & $pAdapter & @CRLF) $oAdapter = ObjCreateInterface($pAdapter, $sIID_IDXGIAdapter, $sTag__IDXGIAdapter) ConsoleWrite("IsObj($oAdapter): " & IsObj($oAdapter) & @CRLF) If IsObj($oAdapter) Then $tApdaterDescription = DllStructCreate($sTag_DXGI_ADAPTER_DESC) $oAdapter.GetDesc(DllStructGetPtr($tApdaterDescription)) ConsoleWrite(">>>>>>>>>>>Adapter Information<<<<<<<<<<<<<" & @CRLF) ConsoleWrite("Description: " & $tApdaterDescription.Description & @CRLF) ConsoleWrite("VendorId: " & $tApdaterDescription.VendorId & @CRLF) ConsoleWrite("DeviceId: " & $tApdaterDescription.DeviceId & @CRLF) ConsoleWrite("SubSysId: " & $tApdaterDescription.SubSysId & @CRLF) ConsoleWrite("Revision: " & $tApdaterDescription.Revision & @CRLF) ConsoleWrite("DedicatedVideoMemory: " & $tApdaterDescription.DedicatedVideoMemory & @CRLF) ConsoleWrite("DedicatedSystemMemory: " & $tApdaterDescription.DedicatedSystemMemory & @CRLF) ConsoleWrite("SharedSystemMemory: " & $tApdaterDescription.SharedSystemMemory & @CRLF) ConsoleWrite(@CRLF & @CRLF) $oAdapter = 0 EndIf $i += 1 WEnd Func _WinAPI_CLSIDFromString($sGUID) Local $tGUID = DllStructCreate('ulong Data1;ushort Data2;ushort Data3;byte Data4[8]') Local $iRet = DllCall('ole32.dll', 'uint', 'CLSIDFromString', 'wstr', $sGUID, 'ptr', DllStructGetPtr($tGUID)) If (@error) Or ($iRet[0]) Then Return SetError(@error, @extended, 0) EndIf Return $tGUID EndFunc ;==>_WinAPI_CLSIDFromString my question is how would i go from c to autoit. and make it reliable. the most interresting function is DXGIOutputDuplication::AcquireNextFrame i wonder if it is possible to request regions of a screen and if it is possible to get hex values of the pixels very fast.