Jump to content

Recommended Posts

Posted (edited)

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.

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:-)
Posted

I think is possible. I think this C++ Example can help you.

 

 

Saludos

  • 3 months later...
Posted (edited)

i tried adding:

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)
        Local $x = 0
        Local $pOutput = 0
        Local $oOutput = 0
        While not $oAdapter.EnumOutputs($x,$pOutput) = $DXGI_ERROR_NOT_FOUND
            $oOutput = ObjCreateInterface($pOutput, $sIID_IDXGIAdapter, $sTag__IDXGIAdapter)
            ConsoleWrite("IsObj($oOutput): " & IsObj($oOutput) & @CRLF)
            $tOutputDescription = DllStructCreate($sTag_DXGI_ADAPTER_DESC)
            $oOutput.GetDesc(DllStructGetPtr($tOutputDescription))
            ConsoleWrite("Output: " & $oOutput.Size & @CRLF)
            $x += 1
        WEnd
        $oOutput = 0
        ConsoleWrite(@CRLF & @CRLF)
        $oAdapter = 0
    EndIf
    $i += 1
WEnd

but i can't get a adapter to show the connected monitors and their screensize. could you give me a hint how to create the needed dll struct?

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:-)
  • 4 weeks later...
Posted

for future reference, i was able to create a c++ executable that forwards the part of the screen as html pixel data via named pipe to autoit.

https://github.com/jrsmile/DXGICapture2NamedPipe

it is far from polished but the concept works.

i would rather like to do it in AutoIT but so far no chance.

$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:-)
Posted (edited)

Interestning, unfortunatelly beyond of my knowledge.
But I will keep an eye on this thread.
 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Hello @JRSmile I did not notice your message when you ask for help with get a adapter to show the connected monitors and their screensize. I'll try to look deeply later.

Nice project DXGICapture2NamedPipe.

 

Saludos

 

 

Posted (edited)

i got around by converting the dxgi c++ example into a dll and using dllcalls to get the data i want.

@Danyfirex i still have the goal to scrap the dll and do it only in autoit with the desktop duplication api.

this evening i will update my github to represent a working sample.

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:-)
Posted (edited)

I tedted the Dll seems to be working right using trancexx example. 

Between here is a step up for do it in raw autoit code. But I think the dll alternative is the best, because raw autoit code will slow down all.

;~ #AutoIt3Wrapper_UseX64=y
;~ https://www.purebasic.fr/german/viewtopic.php?f=3&t=30900
#include <WinAPI.au3>
Global Const $D3D11_SDK_VERSION = 7
Global Const $D3D_FEATURE_LEVEL_9_1 = 0
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;"


Global Const $sTag_IDXGIOutput = $sTag_DummyIDXGIObject & "GetDesc hresult(ptr); GetDisplayModeList hresult(int;uint;uint*;ptr); FindClosestMatchingMode hresult(ptr;ptr;ptr); " & _
        "WaitForVBlank hresult(); TakeOwnership hresult(); ReleaseOwnership hresult(); GetGammaControlCapabilities hresult(); SetGammaControl hresult(); " & _
        "GetGammaControl hresult() SetDisplaySurface hresult(); GetDisplaySurfaceData hresult(); GetFrameStatistics result();"
Global Const $sIID_IDXGIOutput = "{ae02eedb-c735-4690-8d52-5a8dc20213aa}"

Global Const $sTag_DXGI_OUTPUT_DESC = "wchar DeviceName[32];long Left;long Top;long Right;long Bottom;bool AttachedToDesktop;int Rotation;handle Monitor;"

;from IDXGIOutput
Global Const $sTag_IDXGIOutput1 = $sTag_IDXGIOutput & " GetDisplayModeList1 hresult(); FindClosestMatchingMode1 hresult(); GetDisplaySurfaceData1 hresult(ptr;ptr);" & _
        "DuplicateOutput hresult(ptr;ptr*);"
Global Const $sIID_IDXGIOutput1 = "{00cddea8-939b-4b83-a340-a685226666cc}"


Global Const $sTag_IDXGIOutputDuplication = $sTag_DummyIDXGIObject & "GetDesc hresult(ptr); AcquireNextFrame hresult(uint;ptr;ptr*); GetFrameDirtyRects(uint;ptr;uint*);" & _
        "GetFrameMoveRects hresult(uint;ptr;uint*); GetFramePointerShape hresult(uint;ptr*;uint*;ptr); MapDesktopSurface hresult(ptr); UnMapDesktopSurface hresult(); ReleaseFrame hresult();"
Global Const $sIID_IDXGIOutputDuplication = "{191cfac3-a341-470d-b26e-a864f428319c}"


Global Const $sCLSID_WICImagingFactory="{cacaf262-9370-4615-a13b-9f5539da4c0a}"
Global Const $sIID_IWICImagingFactory= "{ec5ec8a9-c395-4314-9c77-54d7a935ff70}"
Global Const $sTag_IWICImagingFactory="CreateDecoderFromFilename hresult();"


Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")


;~ DllOpen("DXGI.dll")
DllOpen("D3D11.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)



        Local $pOutput = 0
        Local $oOutput = 0
        Local $x = 0
        While Not $oAdapter.EnumOutputs($x, $pOutput) = $DXGI_ERROR_NOT_FOUND
            ConsoleWrite("$pOutput: " & $pOutput & @CRLF)
            $oOutput = ObjCreateInterface($pOutput, $sIID_IDXGIOutput, $sTag_IDXGIOutput)
            ConsoleWrite("IsObj($oOutput): " & IsObj($oOutput) & @CRLF)

            Local $tOutputDescription = DllStructCreate($sTag_DXGI_OUTPUT_DESC)
            $oOutput.GetDesc(DllStructGetPtr($tOutputDescription))
            ConsoleWrite(">>>>>>>>>>>Output Information<<<<<<<<<<<<<" & @CRLF)
            ConsoleWrite("DeviceName: " & $tOutputDescription.DeviceName & @CRLF)
            ConsoleWrite("Left: " & $tOutputDescription.Left & @CRLF)
            ConsoleWrite("Top: " & $tOutputDescription.Top & @CRLF)
            ConsoleWrite("Right: " & $tOutputDescription.Right & @CRLF)
            ConsoleWrite("Bottom: " & $tOutputDescription.Bottom & @CRLF)
            ConsoleWrite("AttachedToDesktop: " & $tOutputDescription.AttachedToDesktop & @CRLF)
            ConsoleWrite("Monitor: " & $tOutputDescription.Monitor & @CRLF)
            $x += 1

            If $tOutputDescription.AttachedToDesktop Then
                Local $pID3D11Device = 0
                Local $pID3D11DeviceContext = 0

                Local $aRet = DllCall("D3D11.dll", "long", "D3D11CreateDevice", "ptr", $pAdapter, "int", 0, _ ;D3D_DRIVER_TYPE_UNKNOWN
                        "handle", 0, "uint", 0, "ptr", 0, "uint", 0, "uint", $D3D11_SDK_VERSION, "ptr*", 0, "int", $D3D_FEATURE_LEVEL_9_1, "ptr*", 0)
                ConsoleWrite("D3D11CreateDevice: " & $aRet[0] & @TAB & "@error: " & @error & @CRLF)
                $pID3D11Device = $aRet[8]
                $pID3D11DeviceContext = $aRet[10]
                ConsoleWrite("$pD3D11Device: " & $pID3D11Device & @CRLF)
                ConsoleWrite("$pD3D11DeviceContext: " & $pID3D11DeviceContext & @CRLF)

;~              ;using GueryInterface
;~              Local $pOutput1 = 0
;~              $oOutput.QueryInterface($sIID_IDXGIOutput1, $pOutput1)
;~              Local $oOutput1 = ObjCreateInterface($pOutput1, $sIID_IDXGIOutput1, $sTag_IDXGIOutput1)
;~              ConsoleWrite("IsObj($oOutput1): " & IsObj($oOutput1) & @CRLF)
;~              ConsoleWrite("ObjName($oOutput1): " & ObjName($oOutput1) & @CRLF)
;~              Local $tOutputDescription1 = DllStructCreate($sTag_DXGI_OUTPUT_DESC)
;~              $oOutput1.GetDesc(DllStructGetPtr($tOutputDescription1))

;~                 ;using ObjCreateInterface
                Local $oOutput1 = ObjCreateInterface($oOutput(), $sIID_IDXGIOutput1, $sTag_IDXGIOutput1)
                Local $tOutputDescription1 = DllStructCreate($sTag_DXGI_OUTPUT_DESC)
                $oOutput1.GetDesc(DllStructGetPtr($tOutputDescription1))
                ConsoleWrite(">>>>>>>>>>>Output1 Information<<<<<<<<<<<<<" & @CRLF)
                ConsoleWrite("DeviceName: " & $tOutputDescription1.DeviceName & @CRLF)
                ConsoleWrite("Left: " & $tOutputDescription1.Left & @CRLF)
                ConsoleWrite("Top: " & $tOutputDescription1.Top & @CRLF)
                ConsoleWrite("Right: " & $tOutputDescription1.Right & @CRLF)
                ConsoleWrite("Bottom: " & $tOutputDescription1.Bottom & @CRLF)
                ConsoleWrite("AttachedToDesktop: " & $tOutputDescription1.AttachedToDesktop & @CRLF)
                ConsoleWrite("Monitor: " & $tOutputDescription1.Monitor & @CRLF)


                Local $pDXGIOutputDuplication = 0
                Local $oDXGIOutputDuplication = 0
                $oOutput1.DuplicateOutput($pID3D11Device, $pDXGIOutputDuplication)
                ConsoleWrite("$pDXGIOutputDuplication: " & $pDXGIOutputDuplication & @CRLF)

            EndIf

        WEnd
        ConsoleWrite(@CRLF & @CRLF)
        $oOutput = 0 ;free output
        $oAdapter = 0 ;free adapter
    EndIf
    $i += 1
WEnd


Local $oImagingFactory=ObjCreateInterface($sCLSID_WICImagingFactory,$sIID_IWICImagingFactory,$sTag_IWICImagingFactory)
ConsoleWrite("IsObj($oImagingFactory): " & IsObj($oImagingFactory) & @CRLF)



; User's COM error function. Will be called if COM error occurs
Func _ErrFunc($oError)
    ; Do anything here.
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_ErrFunc


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

 

PD: some method tag need to be fixed because I was to lazy to set correct parameters type for each method.

Saludos 

Edited by Danyfirex

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
  • Recently Browsing   0 members

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