Jump to content

dll call failed


JRSmile
 Share

Recommended Posts

Hi i am strugeling with a dll call from autoit, i can't even open the dll.

 

the dll source can be found here, i compiled it for 32 and 64 bit with windows 10 sdk and visual studio 2017.

https://github.com/bryal/DXGCap

/ C ABI
extern "C" {
    __declspec(dllexport)
    void init() {
        CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
    }

    __declspec(dllexport)
    void uninit() {
        CoUninitialize();
    }

    __declspec(dllexport)
    void* create_dxgi_manager() {
        DXGIManager* dxgi_manager = new DXGIManager();
        dxgi_manager->setup();
        return (void*)dxgi_manager;
    }
    __declspec(dllexport)
    void delete_dxgi_manager(void* dxgi_manager) {
        DXGIManager* m = (DXGIManager*)(dxgi_manager);
        delete m;
    }

    __declspec(dllexport)
    void set_timeout(void* dxgi_manager, uint32_t timeout) {
        ((DXGIManager*)dxgi_manager)->set_timeout(timeout);
    }

    __declspec(dllexport)
    void set_capture_source(void* dxgi_manager, uint16_t cs) {
        ((DXGIManager*)dxgi_manager)->set_capture_source(cs);
    }

    __declspec(dllexport)
    uint16_t get_capture_source(void* dxgi_manager) {
        return ((DXGIManager*)dxgi_manager)->get_capture_source();
    }

    __declspec(dllexport)
    bool refresh_output(void* dxgi_manager) {
        return ((DXGIManager*)dxgi_manager)->refresh_output();
    }

    __declspec(dllexport)
    void get_output_dimensions(void*const dxgi_manager, uint32_t* width, uint32_t* height) {
        RECT dimensions = ((DXGIManager*)dxgi_manager)->get_output_rect();
        *width = dimensions.right - dimensions.left;
        *height = dimensions.bottom - dimensions.top;
    }

    // Return the CaptureResult of acquiring frame and its data
    __declspec(dllexport)
    uint8_t get_frame_bytes(void* dxgi_manager, size_t* o_size, uint8_t** o_bytes) {
        return ((DXGIManager*)dxgi_manager)->get_output_data(o_bytes, o_size);
    }
}

// Debugging
int main(int argc, _TCHAR* argv[]) {
    init();

    auto dxgi_manager = create_dxgi_manager();
    if (dxgi_manager == NULL) {
        printf("dxgi_manager is null\n");
        return 1;
    }
    uint32_t width, height;
    get_output_dimensions(dxgi_manager, &width, &height);
    printf("%d x %d\n", width, height);

    size_t buf_size;
    uint8_t* buf = NULL;
    for (size_t i = 0; i < 60000; i++) {
        switch (get_frame_bytes(dxgi_manager, &buf_size, &buf)) {
            case CR_OK:
                break;
            case CR_ACCESS_DENIED:
                printf("Access denied\n");
                break;
            case CR_ACCESS_LOST:
                printf("Access lost\n");
                break;
            case CR_TIMEOUT:
                printf("Timeout\n");
                break;
            case CR_FAIL:
                printf("General failure\n");
                break;
        }
    }

    get_frame_bytes(dxgi_manager, &buf_size, &buf);
    
    printf("Saving capture to capture.bmp\n");

    CComPtr<IWICImagingFactory> spWICFactory;
    TRY_RETURN(spWICFactory.CoCreateInstance(CLSID_WICImagingFactory));

    CComPtr<IWICBitmap> spBitmap;
    TRY_RETURN(spWICFactory->CreateBitmapFromMemory(width, height, GUID_WICPixelFormat32bppBGRA, width * 4, buf_size, buf, &spBitmap));

    CComPtr<IWICStream> spStream;

    TRY_RETURN(spWICFactory->CreateStream(&spStream));
    TRY_RETURN(spStream->InitializeFromFilename(L"capture.bmp", GENERIC_WRITE));

    CComPtr<IWICBitmapEncoder> spEncoder;
    TRY_RETURN(spWICFactory->CreateEncoder(GUID_ContainerFormatBmp, NULL, &spEncoder));
    TRY_RETURN(spEncoder->Initialize(spStream, WICBitmapEncoderNoCache));

    CComPtr<IWICBitmapFrameEncode> spFrame;
    TRY_RETURN(spEncoder->CreateNewFrame(&spFrame, NULL));
    TRY_RETURN(spFrame->Initialize(NULL));
    TRY_RETURN(spFrame->SetSize(width, height));

    WICPixelFormatGUID format;
    TRY_RETURN(spBitmap->GetPixelFormat(&format));
    TRY_RETURN(spFrame->SetPixelFormat(&format));
    TRY_RETURN(spFrame->WriteSource(spBitmap, NULL));
    TRY_RETURN(spFrame->Commit());
    TRY_RETURN(spEncoder->Commit());

    delete_dxgi_manager(dxgi_manager);

    return 0;
}

 

unfortunaltely even the dll open call already fails to succeed.

#include <array.au3>
$hDLL = DllOpen(@ScriptDir & "\DXGCap64.dll")
if $hDLL = -1 Then ConsoleWrite("!ERROR " & @error & @CRLF)
DllCall($hDLL, "void", "init")
if @error Then ConsoleWrite("!ERROR" & @CRLF)
$hd = DllCall(@ScriptDir & "\DXGCap64.dll","void","init")
_ArrayDisplay($hd)
if @error Then ConsoleWrite("!ERROR" & @CRLF)
DllCall($hDLL, "void", "uninit")
if @error Then ConsoleWrite("!ERROR" & @CRLF)
DllClose($hDLL)
Quote

>Running:(3.3.14.3):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\user\DXGCap-master\x64\Release\hai.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
!ERROR
!ERROR
!ERROR

can anyone tell me what i do wrong?

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

48 minutes ago, FrancescoDiMuro said:

@JRSmile

if @error Then ConsoleWrite("!ERROR: " & @error & @CRLF)

So you can know what kind of error code is returned, and debug it :)

as seen in the output log i dont :-( there is no errorcode in the output

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

12 minutes ago, trancexx said:

There's no such thing as "void" in AutoIt. Use "none".

thank you should have read the dllcall help better....

 

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

still some questions :-) @trancexx

i got further and tried to keep near the help file.

but i got stuck again.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <array.au3>
Local $width, $hight, $output, $hdll
$hDLL = DllOpen("DXGCap64.dll")
if $hDLL = -1 Then ConsoleWrite("!ERROR 1" & @error & @CRLF)
DllCall($hDLL, "none", "init")
if @error Then ConsoleWrite("!ERROR2" & @CRLF)
DllCall($hDLL, "none", "create_dxgi_manager")
if @error Then ConsoleWrite("!ERROR3" & @CRLF)
$hd = DllCall($hdll,"USHORT","get_capture_source")
 if @error Then ConsoleWrite("!ERROR4" & @CRLF)
ConsoleWrite(_ArrayToString($hd))
;~ DllCall($hDLL, "none", "set_capture_source","USHORT",1)
;~ if @error Then ConsoleWrite("!ERROR5" & @CRLF)
;~ $hd = DllCall($hdll,"none","get_output_dimensions","ULONG_PTR",$width,"ULONG_PTR",$hight)
;~ if @error Then ConsoleWrite("!ERROR6" & @CRLF)
;~ _ArrayDisplay($hd)
;~ ConsoleWrite($width & " " & $hight & @CRLF)
;~ DllCall($hDLL, "none", "delete_dxgi_manager")
;~ if @error Then ConsoleWrite("!ERROR7" & @CRLF)
DllCall($hDLL, "none", "uninit")
if @error Then ConsoleWrite("!ERROR8" & @CRLF)
DllClose($hDLL)
if @error Then ConsoleWrite("!ERROR9" & @CRLF)

it looks like i can init the dll and get the dxgi manager created i even get a 1 back when getting capture source.

if i want to set capture source or try to get the width or hight of the desktop autoit exits.

could you assist again please?

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

cleaned it up a little.

only the commented out stuff makes my head itch.

#AutoIt3Wrapper_UseX64=y
#NoTrayIcon
#include <array.au3>
Local $width, $hight, $output, $hdll,$o_byte,$o_size
$hDLL = DllOpen("DXGCap64.dll")
DllCall($hDLL, "none", "init")
DllCall($hDLL, "none", "create_dxgi_manager")
$hd = DllCall($hdll,"USHORT","get_capture_source")
ConsoleWrite("+capsrc: " & _ArrayToString($hd) & @CRLF)
$hd = DllCall($hDLL, "BOOLEAN", "refresh_output")
ConsoleWrite("+refresh: " & _ArrayToString($hd) & @CRLF)
;~ DllCall($hDLL, "none", "set_capture_source","USHORT",1)
;~ if @error Then ConsoleWrite("!ERROR6" & @CRLF)
;~ $hd = DllCall($hdll,"none","get_output_dimensions","ULONG_PTR",$width,"ULONG_PTR",$hight)
;~ if @error Then ConsoleWrite("!ERROR7" & @CRLF)
;~ _ArrayDisplay($hd)
;~ ConsoleWrite($width & " " & $hight & @CRLF)
;~ $hd = DllCall($hdll,"BYTE","get_frame_bytes","ULONG_PTR",$o_size,"BYTE",$o_byte)
;~ ConsoleWrite("+frames: " & _ArrayToString($hd) & @CRLF)
;~ ConsoleWrite($o_size & @CRLF)
;~ ConsoleWrite($o_byte & @CRLF)
;~ DllCall($hDLL, "none", "delete_dxgi_manager")
;~ if @error Then ConsoleWrite("!ERROR8" & @CRLF)
DllCall($hDLL, "none", "uninit")
DllClose($hDLL)

i know its a type conversion problem, or do i have to use structs?

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

;~ void init()
DllCall($hDLL, "none:cdecl", "init")
If @error Then Exit -1

;~ void* create_dxgi_manager()
$aCall = DllCall($hDLL, "ptr:cdecl", "create_dxgi_manager")
If @error Then Exit -2

; Read data
$pManager = $aCall[0]

;~ void get_output_dimensions(void*const dxgi_manager, uint32_t* width, uint32_t* height)
$aCall = DllCall($hDLL, "none:cdecl", "get_output_dimensions", "ptr", $pManager, "uint*", 0, "uint*", 0)
If @error Then Exit -3

ConsoleWrite("Width = " & $aCall[2] & ", Height = " & $aCall[3] & @CRLF)

;~ uint8_t get_frame_bytes(void* dxgi_manager, size_t* o_size, uint8_t** o_bytes)
Local $pBuffer, $iBufferSize
$aCall = DllCall($hDLL, "byte:cdecl", "get_frame_bytes", "ptr", $pManager, "uint*", 0, "ptr*", 0)
If @error Then Exit -4

; Read data
$iBufferSize = $aCall[2]
$pBuffer = $aCall[3]

; Fill the buffer
$aCall = DllCall($hDLL, "byte:cdecl", "get_frame_bytes", "ptr", $pManager, "uint*", $iBufferSize, "ptr", $pBuffer)
If @error Then Exit -5

; Make the data accessible thru dllstruct
$tData = DllStructCreate("byte[" & $iBufferSize & "]", $pBuffer)
If @error Then Exit -6

ConsoleWrite("Data = " & BinaryMid(DllStructGetData($tData, 1), 1, 30000) & @CRLF) ; print first 30000 bytes

;~ void delete_dxgi_manager(void* dxgi_manager)
DllCall($hDLL, "none:cdecl", "delete_dxgi_manager", "ptr", $pManager)
If @error Then Exit -7

You probably just lack experience.

 

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

6 hours ago, KaFu said:

Please share the compiled dlls, thanks!

as wished.

DXGCap32.dll

DXGCap64.dll

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

  • 2 months later...

@JRSmile, I'm curious. I checked the speed of the DLL vs. _ScreenCapture_Capture() 

Spoiler
#AutoIt3Wrapper_UseX64=y

#include <array.au3>
#include <ScreenCapture.au3>
Local $iTimer = TimerInit()

Local $width, $hight, $output, $hdll,$o_byte,$o_size
$hDLL = DllOpen("DXGCap64.dll")

;~ void init()
DllCall($hDLL, "none:cdecl", "init")
If @error Then Exit -1

;~ void* create_dxgi_manager()
$aCall = DllCall($hDLL, "ptr:cdecl", "create_dxgi_manager")
If @error Then Exit -2

; Read data
$pManager = $aCall[0]

;~ void get_output_dimensions(void*const dxgi_manager, uint32_t* width, uint32_t* height)
$aCall = DllCall($hDLL, "none:cdecl", "get_output_dimensions", "ptr", $pManager, "uint*", 0, "uint*", 0)
If @error Then Exit -3

ConsoleWrite("Width = " & $aCall[2] & ", Height = " & $aCall[3] & @CRLF)

;~ uint8_t get_frame_bytes(void* dxgi_manager, size_t* o_size, uint8_t** o_bytes)
Local $pBuffer, $iBufferSize
$aCall = DllCall($hDLL, "byte:cdecl", "get_frame_bytes", "ptr", $pManager, "uint*", 0, "ptr*", 0)
If @error Then Exit -4

; Read data
$iBufferSize = $aCall[2]
$pBuffer = $aCall[3]

; Fill the buffer
$aCall = DllCall($hDLL, "byte:cdecl", "get_frame_bytes", "ptr", $pManager, "uint*", $iBufferSize, "ptr", $pBuffer)
If @error Then Exit -5

; Make the data accessible thru dllstruct
$tData = DllStructCreate("byte[" & $iBufferSize & "]", $pBuffer)
If @error Then Exit -6

;~ ConsoleWrite("Data = " & BinaryMid(DllStructGetData($tData, 1), 1, 30000) & @CRLF) ; print first 30000 bytes
;~ FileDelete(@ScriptDir & "\DXGCap64.Cap.bmp")
;~ FileWrite(@ScriptDir & "\DXGCap64.Cap.bmp", DllStructGetData($tData, 1))

;~ void delete_dxgi_manager(void* dxgi_manager)
DllCall($hDLL, "none:cdecl", "delete_dxgi_manager", "ptr", $pManager)
If @error Then Exit -7



ConsoleWrite(TimerDiff($iTimer) & @CRLF)
$iTimer = TimerInit()

Example()
ConsoleWrite(TimerDiff($iTimer) & @CRLF)


Func Example()
    Local $hBmp
    ; Capture full screen
    $hBmp = _ScreenCapture_Capture("")
    ; Save bitmap to file
;~  _ScreenCapture_SaveImage(@MyDocumentsDir & "\GDIPlus_Image.jpg", $hBmp)
;~  ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg")
EndFunc   ;==>Example

 

and I don't see the gain ( other than to learn. I don't know how to save the image in the struct ).
If you care to share the story ( and how to save the capture to file ) :) 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

On 17/09/2018 at 11:27 PM, trancexx said:

You probably just lack experience.

 

After all i did in autoIT i am now getting more and more day after day to manipulate DLL's Do anyone got an/some advise for me for learn how to play with DLL in AutoIT ? I need theory. And of course some practices.

 

Maybe in frensh if you are or in english no problem

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

@caramen You should do a forum search here is a Tutorial 

You can check AutoIt include UDFs compare with MSDN API calls etc. Tips: Learn Dllcall correct declaration, Make sure to do correct data conversion from API to AutoIt Dllcall, Learn About Pointers.

 

Saludos

Link to comment
Share on other sites

@Danyfirex Rooooooh Man Thx :) I will do that this week end :) .

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

On 22.11.2018 at 8:28 PM, argumentum said:

@JRSmile, I'm curious. I checked the speed of the DLL vs. _ScreenCapture_Capture() 

and I don't see the gain ( other than to learn. I don't know how to save the image in the struct ).
If you care to share the story ( and how to save the capture to file ) :) 

@argumentum i needed a solution that is known to be able to read the GPU framebuffer. 

a screenshot didn't capture all overlays in my tests.

the other thing from what i undertand that the process writing to the gpu is not able to see the copy of the frame beeing leeached. and is not disturbed otherwise.

i theory you could be able to get nearly realtime fps from the dxgi api at least on newer cards as the use the copy commands which are part of the gpu.

i am researching KI and a quick and application independant true grab of the gpu framebuffer is key to my solution.

autoit helps for POCs but i think i have to switch to python soon :-(

these new tensor cores on rtx 2060+ cards are more then interresting.

 

i was able to save a bmp, you might want to look at the original source.

https://github.com/pgurenko/DXGICaptureSample/blob/master/DXGICaptureSample/DXGICaptureSample.cpp

 

Edited by JRSmile
$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

  • 1 month later...

JRSmile, I cannot run Your dll on win7.

I ve got error: on this line:
 

Quote

 

$aCall = DllCall($hDLL, "none:cdecl", "get_output_dimensions", "ptr", $pManager, "uint*", 0, "uint*", 0)

>Exit code: 3221225477    Time: 3.087

 

Does it occur because You compiled it with windows 10 sdk and visual studio 2017?

Thank You!

Link to comment
Share on other sites

As I understand correctly it uses Desktop Duplication API which is only for win8+.

Therefore it will not work on Win7.

trancexx, can You help please to transfer this code from c++ to autoit.

It gives opportunity to save 30 frames per second.

// DXGICaptureSample.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "DXGIManager.h"
#include <time.h>

DXGIManager g_DXGIManager;

int capture(RECT& rcDim, vector<BYTE>& buf, CComPtr<IWICImagingFactory>& spWICFactory) {
  DWORD dwWidth = rcDim.right - rcDim.left;
  DWORD dwHeight = rcDim.bottom - rcDim.top;
  DWORD dwBufSize = buf.size();

  HRESULT hr = g_DXGIManager.GetOutputBits(buf.data(), rcDim);
  if (FAILED(hr))
  {
    printf("GetOutputBits failed with hr=0x%08x\n", hr);
    return hr;
  }
  return 0;
}

int _tmain(int argc, _TCHAR* argv[]) {
  CoInitialize(NULL);

  g_DXGIManager.SetCaptureSource(CSDesktop);

  RECT rcDim;
  g_DXGIManager.GetOutputRect(rcDim);

  DWORD dwWidth = rcDim.right - rcDim.left;
  DWORD dwHeight = rcDim.bottom - rcDim.top;

  printf("dwWidth=%d dwHeight=%d\n", dwWidth, dwHeight);

  DWORD dwBufSize = dwWidth*dwHeight * 4;

  vector<BYTE> buf(dwBufSize);

  CComPtr<IWICImagingFactory> spWICFactory = NULL;
  HRESULT hr = spWICFactory.CoCreateInstance(CLSID_WICImagingFactory);
  if (FAILED(hr))
    return hr;

  clock_t t1 = clock();
  int i;
  int iterations = 100;  
  for (i = 0; i < iterations; i++) {
    capture(rcDim, buf, spWICFactory);
  }
  clock_t t2 = clock();
  printf("%d iterations: %0.0f fps\n", iterations, iterations / ((double)(t2 - t1) / CLOCKS_PER_SEC));

  return 0;
}

https://github.com/pgurenko/DXGICaptureSample/issues/2#issuecomment-334050901

Thank You!

 

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...