Sign in to follow this  
Followers 0
RagsRevenge

VBS to AutoIt conversion problem

17 posts in this topic

Hi,

As part of a project, I am converting the following vbs into AutoIt. There is no relevant code before this excerpt.

VBS

Set e3 = CreateObject( "CT.Application" )
Set prj = e3.CreateJobObject
Set dev = prj.CreateDeviceObject

countDevIDs = prj.GetAllDeviceIds (devids)

e3.PutInfo 0, "Number of Devices in Project: " & countDevIDs 
e3.PutInfo 0, "1st Device: " & devids(1)

AutoIt

Local $oE3 = ObjCreate("CT.Application")
Local $oPrj = $oE3.CreateJobObject
Local $oDev = $oPrj.CreateDeviceObject

Local $devIDs
Local $countDevIDs = $oPrj.GetAllDeviceIds($devIDs)

$oE3.putInfo(0, "Number of Devices in Project: " & $countDevIDs)
$oE3.putInfo(0, "1st Device: " & $devIDs[1])

But am getting an error on the last line that "Subscript used with non-Array variable." in the AutoIt code. countDevIDs returns 4599 in both instances, so it looks as though the function is working ok. I have also tried Local $devIDs[1] which falls over with "Array variable has incorrect number of subscripts or subscript dimension range exceeded." If I try something like Local $devIDs[1000], my code doesn't give an error, but every element is empty after the "$oPrj.GetAllDeviceIds($devIDs)" call. The VBS won't work if I dim devIDs with an arbitrary size. It works fine if I don't explicitly dim the array, or just dim it like "dim devids"

The documentation for this COM interface is pretty poor.

"

GetAllDeviceIds (ids)

cnt = opt.GetAllDeviceIds( ids )

cnt: Number of option identifiers returned in array ids()

ids: Array (index of 1..n, index 0 is not used) of option identifiers.

In general this method only returns objects that are assigned the option or variant opt.

Notes: opt.GetAllDeviceIds() may return identifiers (optional but not essential) that are not returned with prj.GetAllDeviceIds() if a component in a certain inactive variant is defined as a new instance (e.g. with a component that is not identical in construction). This method doesn't differentiate between normal devices, connectors, blocks, etc.

"

Any help would be greatly appreciated.

D

Share this post


Link to post
Share on other sites



Try changing

$oE3.putInfo(0, "1st Device: " & $devIDs[1])

to

$oE3.putInfo(0, "1st Device: " & $devIDs(1))

or

$oE3.putInfo(0, "1st Device: " & $devIDs.count())

Share this post


Link to post
Share on other sites

Try changing

$oE3.putInfo(0, "1st Device: " & $devIDs[1])

to

$oE3.putInfo(0, "1st Device: " & $devIDs(1))

or

$oE3.putInfo(0, "1st Device: " & $devIDs.count())

Thanks for the assistance...

$oE3.putInfo(0, "1st Device: " & $devIDs(1)) gives "Error in expression."

$oE3.putInfo(0, "1st Device: " & $devIDs.count()) gives "Variable must be of type "Object"."

I don't think my problem is in how I reference the array element, but more that the called function: $oPrj.GetAllDeviceIds($devIDs) doesn't seem to behave the same in AutoIt as it does in VBS, and I'm stumped as to why.

Cheers,

D

Share this post


Link to post
Share on other sites

$oE3.putInfo(0, "1st Device: " & $devIDs.count()) gives "Variable must be of type "Object"."

There. If it's not an object and not an array then what it is?
ConsoleWrite(VarGetType($devIDs) & @CRLF)

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

There. If it's not an object and not an array then what it is?

ConsoleWrite(VarGetType($devIDs) & @CRLF)

It depends how I declare the variable.

AutoIt

Local $devIDs[1]
ConsoleWrite(VarGetType($devIDs) & @CRLF)           ;gives array
Local $countDevIDs = $oPrj.GetAllDeviceIds($devIDs)
ConsoleWrite(VarGetType($devIDs) & @CRLF)           ;gives array

AutoIt

Local $devIDs
ConsoleWrite(VarGetType($devIDs) & @CRLF)           ;gives string
Local $countDevIDs = $oPrj.GetAllDeviceIds($devIDs)
ConsoleWrite(VarGetType($devIDs) & @CRLF)           ;gives string

VBS

cntDevids = prj.GetAllDeviceIds (devids)
e3.PutInfo 0, "1st Device: " & devids(1)                     ;works

VBS

dim devids

cntDevids = prj.GetAllDeviceIds (devids)
e3.PutInfo 0, "1st Device: " & devids(1)                     ;works

VBS

dim devids(1000)

cntDevids = prj.GetAllDeviceIds (devids)                     ;gives an "Invalid Callee" error on this line, Code: 80020010
e3.PutInfo 0, "1st Device: " & devids(1)

VBS

dim devids

msgbox isArray(devids)                                 ;gives False
cntDevids = prj.GetAllDeviceIds (devids)
msgbox isArray(devids)                                 ;gives True

Confused!

D

Share this post


Link to post
Share on other sites

Oh, you are passing it byref.

You can't do that in AutoIt.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Oh, you are passing it byref.

You can't do that in AutoIt.

I can't call a COM function and pass it a byRef variable, is it?

In that case, I can't use AutoIt for interfacing with E3 due to the design of their API. Or do you know of a workaround?

Cheers,

D

Share this post


Link to post
Share on other sites

I can't call a COM function and pass it a byRef variable, is it?

In that case, I can't use AutoIt for interfacing with E3 due to the design of their API. Or do you know of a workaround?

Cheers,

D

There is a workaround.

Using AutoItObject.au3 you can pass variables byref. It's similar to DllCall(). Find that file and focus on _AutoItObject_WrapperCreate() function.

...There are examples in the package.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

There is a workaround.

Using AutoItObject.au3 you can pass variables byref. It's similar to DllCall(). Find that file and focus on _AutoItObject_WrapperCreate() function.

...There are examples in the package.

Hi,

sorry for the delay in responding, but I got pulled to another project, and then spent a fair while trying to figure it out. I'm new to dllCall(), so _AutoItObject_WrapperCreate() is proving difficult to get my head around.

My first question is...

How do I get a Pointer to an IUnknown-Interface not supporting IDispatch?

Looking at oPlayWAVE.au3 example, it seems I need to find the dll which has the function which initialises the object to the interface I need.

I have found the file which contains all of the COM items which I am using, namely e3.tlb.

oPlayWAVE.au3 uses DllCall to get the pointer to the interface, using DirectSoundCreate8.

; Go direct. DirectSound8 over DirectSound only because of the convinient links (http://msdn.microsoft.com/en-us/library/microsoft.directx_sdk.reference.directsoundcreate8(VS.85).aspx)
Local $aCall = DllCall("dsound.dll", "long", "DirectSoundCreate8", _
        "ptr", 0, _
        "ptr*", 0, _
        "ptr", 0)
If @error Or $aCall[0] Then Exit -2 ; DirectSoundCreate8 or call to it failed
; Collect
Local $pDSound = $aCall[2]
; Define IDirectSound8 vTable methods
Local $tagIDirectSound = "QueryInterface;" & _
        "AddRef;" & _
        "Release;" & _ ; IUnknown
        "CreateSoundBuffer;" & _
        "GetCaps;" & _
        "DuplicateSoundBuffer;" & _
        "SetCooperativeLevel;" & _
        "Compact;" & _
        "GetSpeakerConfig;" & _
        "SetSpeakerConfig;" & _
        "Initialize;" & _ ; IDirectSound
        "VerifyCertification;" ; IDirectSound8
; Wrapp IDirectSound8 interface
Local $oIDirectSound8 = _AutoItObject_WrapperCreate($pDSound, $tagIDirectSound)

My current (not working) code is...

Local $oE3 = ObjCreate("CT.Application")
Local $oPrj = $oE3.CreateJobObject
Local $oDev = $oPrj.CreateDeviceObject
Local $devIDs

Local $countDevIDs = $oPrj.GetAllDeviceIds($devIDs)   ;this call fails as it is trying to pass a byRef parameter
    
$oE3.putInfo(0, "1st Device: " & $devIDs[1])

I'm struggling to see how to convert my code into AutoItObject code, eg: What interface do I need to open first? How do I find out number of parameters, types of parameters, etc. I have a list of methods for the objects, eg: JobObject, etc, and via this list, I can find out the return types of the methods, but is this what I need to do?

I am getting the below information by exploring e3.tlb using DLL Export Viewer. I can get similar info on any other COM method.

Function Name:IApplicationInterface::CreateJobObject
Address:
Relative Address:
Ordinal: 10 (0xa)
Filename: e3.tlb
Full Path: C:\Program Files\Cim-Team\E3.series_2009\e3.tlb
Type: COM Method

but the above seems incomplete.

Any assistance which helps me find this needle in a haystack, or even the right haystack would be greatly appreciated.

D

Edited by RagsRevenge

Share this post


Link to post
Share on other sites

Conveniently, I wrote TYPELIB Viewer. Run that tlb through it.

Your interface supports IDispatch.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Conveniently, I wrote TYPELIB Viewer. Run that tlb through it.

Your interface supports IDispatch.

Thanks for the ongoing assistance...

The 3 functions that I'm currently using are shown below.

==================================================================================

IDispatch IApplicationInterface; // IApplicationInterface Interface

IID = {92219F22-B9EB-4958-92F7-2A1943E69CE2};

// Inherits from: IDispatch {00020400-0000-0000-C000-000000000046}

10. method CreateJobObject

STDCALL FUNC PUREVIRTUAL;

HRESULT CreateJobObject(

[out,retval] idispatch* obj

);

==================================================================================

IDispatch IJobInterface; // IJobInterface Interface

IID = {146C3C3D-4F7D-408F-AE35-5D3F83E7DE52};

// Inherits from: IDispatch {00020400-0000-0000-C000-000000000046}

20. method CreateDeviceObject

STDCALL FUNC PUREVIRTUAL;

HRESULT CreateDeviceObject(

[out,retval] idispatch* obj

);

22. method GetAllDeviceIds

STDCALL FUNC PUREVIRTUAL;

HRESULT GetAllDeviceIds(

[in,out] VARIANT* ids,

[out,retval] int* ret

);

==================================================================================

You say my interface supports iDispatch. Am I still going down the right path to call a method with a byRef parameter via _AutoItObject_WrapperCreate()?

This is what I have come up with so far...

Local $aCall = DllCall("e3.tlb", "ptr", "CreateJobObject")

If @error Or $aCall[0] Then Exit -2 ; CreateJobObject or call to it failed
; Collect
Local $pDJob = $aCall[2]
; Define IJob vTable methods
Local $tagIJob = "QueryInterface;" & _
        "GetID;" & _
        "SetID;" & _ 
        "DumpItem;" & _
        "GetItemType;" & _
        "New;" & _
        "Open;" & _
        "ExportDrawing;" & _
        "ImportDrawing;" & _
        "LoadPart;" & _
        "GetName;" & _ 
        "GetPath;" & _
        "GetType;" & _ 
        "Save;" & _
        "SaveAs;" & _ 
        "Close;" & _
        "IsChanged;" & _ 
        "CreateSheetObject;" & _
        "GetSheetCount;" & _ 
        "GetSheetIds;" & _
        "CreateDeviceObject;" & _
        "GetAllDeviceCount;" & _
        "GetAllDeviceIds;"
Local $oIJob = _AutoItObject_WrapperCreate($pDJob, $tagIJob)

I have included every method listed in your typeLib Viewer (very handy tool, btw) before the method I need to call to the $tagIJob. Does it look ok?

Cheers,

D

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

No. It looks bad.

Try something like this:

#include "AutoitObject.au3"

Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
Func _ErrFunc()
    ConsoleWrite("! COM Error !  Number: 0x" & Hex($oError.number, 8) & "   ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF)
EndFunc   ;==>_ErrFunc


_AutoItObject_StartUp()


Global $oE3 = ObjCreate("CT.Application")
Global $oPrj = $oE3.CreateJobObject
Global $pPrj = _AutoItObject_IDispatchToPtr($oPrj)

If Not $pPrj Then Exit - 1 ; No point in continuing

; Define IJob vTable methods
Local $tagIJob = "QueryInterface;" & _
        "AddRef;" & _
        "Release;" & _ ; IUnknown
        "GetTypeInfoCount;" & _
        "GetTypeInfo;" & _
        "GetIDsOfNames;" & _
        "Invoke;" & _ ; IDispatch
        "GetID;" & _
        "SetID;" & _
        "DumpItem;" & _
        "GetItemType;" & _
        "New;" & _
        "Open;" & _
        "ExportDrawing;" & _
        "ImportDrawing;" & _
        "LoadPart;" & _
        "GetName;" & _
        "GetPath;" & _
        "GetType;" & _
        "Save;" & _
        "SaveAs;" & _
        "Close;" & _
        "IsChanged;" & _
        "CreateSheetObject;" & _
        "GetSheetCount;" & _
        "GetSheetIds;" & _
        "CreateDeviceObject;" & _
        "GetAllDeviceCount;" & _
        "GetAllDeviceIds;"

Global $oIJob = _AutoItObject_WrapperCreate($pPrj, $tagIJob)
ConsoleWrite("IsObj($oIJob) = " & IsObj($oIJob) & @CRLF)

$oIJob.AddRef("dword")
;...

edit:

Since I cannot test that script here's the example that I can. Shell.Application:

#include "AutoitObject.au3"

Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
Func _ErrFunc()
    ConsoleWrite("! COM Error !  Number: 0x" & Hex($oError.number, 8) & "   ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF)
EndFunc   ;==>_ErrFunc

_AutoItObject_StartUp()

Global $oShell = ObjCreate("Shell.Application")
Global $pShell = _AutoItObject_IDispatchToPtr($oShell)

If Not $pShell Then Exit -1 ; No point in continuing

; Define IShellDispatch vTable methods
Global $tagIShellDispatch = "QueryInterface;" & _
        "AddRef;" & _
        "Release;" & _ ; IUnknown
        "GetTypeInfoCount;" & _
        "GetTypeInfo;" & _
        "GetIDsOfNames;" & _
        "Invoke;" & _ ; IDispatch
        "Application;" & _
        "Parent;" & _
        "NameSpace;" & _
        "BrowseForFolder;" & _
        "Windows;" & _
        "Open;" & _
        "Explore;" & _
        "MinimizeAll;" & _
        "UndoMinimizeAll;" & _
        "FileRun;" & _
        "CascadeWindows;" & _
        "TileVertically;" & _
        "TileHorizontally;" & _
        "ShutdownWindows;" & _
        "Suspend;" & _
        "EjectPC;" & _
        "SetTime;" & _
        "TrayProperties;" & _
        "Help;" & _
        "FindFiles;" & _
        "FindComputer;" & _
        "RefreshMenu;" & _
        "ControlPanelItem;" & _ ; IShellDispatch
        "IsRestricted;" & _
        "ShellExecute;" & _
        "FindPrinter;" & _
        "GetSystemInformation;" & _
        "ServiceStart;" & _
        "ServiceStop;" & _
        "IsServiceRunning;" & _
        "CanStartStopService;" & _
        "ShowBrowserBar;" & _ ; IShellDispatch2
        "AddToRecent;" & _ ; IShellDispatch3
        "WindowsSecurity;" & _
        "ToggleDesktop;" & _
        "ExplorerPolicy;" & _
        "GetSetting;" ; IShellDispatch4

Global $oShellWrapped = _AutoItObject_WrapperCreate($pShell, $tagIShellDispatch)
ConsoleWrite("IsObj($oShellWrapped) = " & IsObj($oShellWrapped) & @CRLF)

$oShellWrapped.AddRef("dword")

$oShellWrapped.MinimizeAll("long")
Sleep(2000)
$oShellWrapped.UndoMinimizeAll("long")
$oShellWrapped.FileRun("long")

; Or maybe this:
Global $vVariant = _AutoItObject_VariantSet(0, 36) ; ShellSpecialFolderConstants: ssfWINDOWS = 36
$oShellWrapped.Open("long", "ptr", Number($vVariant))

; Byref (last parameter):
_AutoItObject_VariantSet($vVariant, @DesktopDir)
Global $aCall = $oShellWrapped.BrowseForFolder("long", "hwnd", 0, "wstr", "Aha", "dword", 0x00010010, "ptr", Number($vVariant), "idispatch*", 0)

;If IsObj($aCall[6]) Then ConsoleWrite($aCall[6].Items.Item.Path & @CRLF)
If IsObj($aCall[6]) Then ConsoleWrite($aCall[6].Self.Path & @CRLF)
;...

Any help?

...And I just saw that code have problems if run with 32bit AutoIt. Will see why is that.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

I think it requires the VARIANT-structure directly as a parameter, but AutoIt doesn't support that, you can only pass it by reference and thats not correct.


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Ahhh!

Why in the world x64 code works flawlessly?!? I can't believe it's just coincidence.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Any help?

...And I just saw that code have problems if run with 32bit AutoIt. Will see why is that.

Thanks for the amazing help. The code you provided works perfectly.

I had a look at the Shell example you provided to try to get a deeper understanding, so again that was very helpful.

This is what I've come up with (in addition to your code), but unfortunately, as with your shell example, AutoIt crashes out.

Global $devIDs

Global $vVariant = _AutoItObject_VariantSet(0, $devIDs)
Global $numDevs = $oIJob.GetAllDeviceIDs("long", "ptr", Number($vVariant))   ;return type, parameter1 type, parameter1

Do you think I am out of luck with trying to call a method in AutoIt32 with a byRef parameter?

Thanks,

D

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

I think it requires the VARIANT-structure directly as a parameter, but AutoIt doesn't support that, you can only pass it by reference and thats not correct.

No, that shouldn't be it. If I simply read what's at address of e.g. Open method I get this:

Open
    0x8BFF558BEC568B4D08576A0083EC108BFC8D750CA5A5A5A5E846FFFFFF5F5E5DC21400

That would be something like this:

8BFF                    mov edi, edi              ; nothing
    55                      push ebp                  ; save the value of ebp
    8BEC                    mov ebp, esp              ; ebp points to the top of the stack
    56                      push esi
    8B4D08                  mov ecx, dword[ebp+8d]    ; set ecx to value of first param (function pointer)
    57                      push edi
    6A00                    push 0
    83EC10                  sub esp, 16d              ; make room for four local variables
    8BFC                    mov edi, esp
    8D750C                  lea esi, dword[ebp+12d]   ; load esi with the address of second param
    A5                      movsd                     ; mov edi, esi
    A5                      movsd                     ; ...
    A5                      movsd                     ; ...
    A5                      movsd                     ; ...
    E846FFFFFF              call ...something
    5F                      pop edi
    5E                      pop esi
    5D                      pop ebp
    C21400                  ret 20d
lea instruction means load address. Pointer for sure.

If I switch to using DispCallFunc I can get it to work in all cases but only if I set VT_VARIANT as prgvt array members for those parameters.

In fact, when thinking of it, we shouldn't be needing pointercall function at all.

edit:

Check this out:

;#AutoIt3Wrapper_UseX64=n

#include "AutoitObject.au3"

Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
Func _ErrFunc()
    ConsoleWrite("! COM Error !  Number: 0x" & Hex($oError.number, 8) & "   ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF)
EndFunc   ;==>_ErrFunc

_AutoItObject_StartUp()



$hModule = __Au3Obj_Mem_LoadLibraryEx("user32.dll")
$pAddress = __Au3Obj_Mem_GetAddress($hModule, "MessageBoxW")


$aCall = __Au3Obj_DispCallFunc("dword", $pAddress, "hwnd", 0, "wstr", "Some Text", "wstr", "Some Title", "dword", 50)
ConsoleWrite($aCall[0] & @CRLF)

;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

$hModule = __Au3Obj_Mem_LoadLibraryEx("kernel32.dll")
$pAddress = __Au3Obj_Mem_GetAddress($hModule, "Beep")

$aCall = __Au3Obj_DispCallFunc("dword", $pAddress, "dword", 1500, "dword", 1200)
ConsoleWrite($aCall[0] & @CRLF)








; Byref missing?
Func __Au3Obj_DispCallFunc($sRetType, $pAddress = 0, $sType1 = "", $vParam1 = 0, $sType2 = "", $vParam2 = 0, $sType3 = "", $vParam3 = 0, $sType4 = "", $vParam4 = 0, $sType5 = "", $vParam5 = 0, $sType6 = "", $vParam6 = 0, $sType7 = "", $vParam7 = 0, $sType8 = "", $vParam8 = 0, $sType9 = "", $vParam9 = 0, $sType10 = "", $vParam10 = 0, $sType11 = "", $vParam11 = 0, $sType12 = "", $vParam12 = 0, $sType13 = "", $vParam13 = 0, $sType14 = "", $vParam14 = 0, $sType15 = "", $vParam15 = 0, $sType16 = "", $vParam16 = 0, $sType17 = "", $vParam17 = 0, $sType18 = "", $vParam18 = 0, $sType19 = "", $vParam19 = 0, $sType20 = "", $vParam20 = 0)
    Local $iParamsToProcess = Ceiling((@NumParams - 2) / 2)
    Local $aOut[$iParamsToProcess + 1]
    Local $tTypes = DllStructCreate("word[" & $iParamsToProcess & "]")
    Local $tParams = DllStructCreate("ptr[" & $iParamsToProcess & "]")
    For $i = 1 To $iParamsToProcess
        DllStructSetData($tTypes, 1, __Au3Obj_VarType(Eval("sType" & $i)), $i)
        DllStructSetData($tParams, 1, _AutoItObject_VariantSet(0, Eval("vParam" & $i)), $i)
    Next
    Local $iVarType = __Au3Obj_VarType($sRetType)
    Local $tVAR_OUT = DllStructCreate($__Au3Obj_tagVARIANT)
    DllStructSetData($tVAR_OUT, "vt", $iVarType)
    Local $aCall = DllCall($gh_AU3Obj_oleautdll, "long", "DispCallFunc", _
            "ptr", 0, _ ;<-this will be object pointer - wrapped_object from AutoItWrapObject.cpp
            "dword_ptr", $pAddress, _ ;<-this will be offset into vtable - sizeof(void*)*elem->GetIndex() from AutoItWrapObject.cpp
            "dword", 4, _ ; CC_STDCALL
            "dword", $iVarType, _
            "dword", $iParamsToProcess, _
            "ptr", DllStructGetPtr($tTypes), _
            "ptr", DllStructGetPtr($tParams), _
            "ptr", DllStructGetPtr($tVAR_OUT))
    For $i = 1 To $iParamsToProcess
        $aOut[$i] = _AutoItObject_VariantRead(DllStructGetData($tParams, 1, $i))
        _AutoItObject_VariantFree(DllStructGetData($tParams, 1, $i))
    Next
    $aOut[0] = DllStructGetData(DllStructCreate($sRetType, DllStructGetPtr($tVAR_OUT, "data")), 1)
    Return $aOut
EndFunc   ;==>__Au3Obj_DispCallFunc


Func __Au3Obj_VarType($sType)
    Local $iType
    If StringRight($sType, 1) = "*" Then ; ???
        $sType = StringTrimRight($sType, 1)
        $iType = $__Au3Obj_VT_BYREF
    EndIf
    Local $iType
    Switch $sType
        Case ""
            $iType &= $__Au3Obj_VT_ERROR
        Case "none"
            $iType &= $__Au3Obj_VT_EMPTY
        Case "byte"
            $iType &= $__Au3Obj_VT_I2
        Case "boolean"
            $iType &= $__Au3Obj_VT_BOOL
        Case "short"
            $iType &= $__Au3Obj_VT_I4
        Case "ushort", "word"
            $iType &= $__Au3Obj_VT_UI2
        Case "dword", "uint", "ulong"
            $iType &= $__Au3Obj_VT_UINT
        Case "long", "int", "bool"
            $iType &= $__Au3Obj_VT_INT
        Case "variant" ; new!
            $iType &= $__Au3Obj_VT_VARIANT
        Case "int64"
            $iType &= $__Au3Obj_VT_I8
        Case 'uint64'
            $iType &= $__Au3Obj_VT_UI8
        Case "float"
            $iType &= $__Au3Obj_VT_R4
        Case "double"
            $iType &= $__Au3Obj_VT_R8
        Case "ptr", "handle", "hwnd", "str", "wstr"
            ; !!! Important
            If $__Au3Obj_X64 Then
                $iType &= $__Au3Obj_VT_PTR
            Else
                $iType &= $__Au3Obj_VT_UINT
            EndIf
        Case "int_ptr", "long_ptr", "lresult", "lparam"
            ; !!! Important
            If $__Au3Obj_X64 Then
                $iType &= $__Au3Obj_VT_PTR
            Else
                $iType &= $__Au3Obj_VT_INT
            EndIf
        Case "uint_ptr", "ulong_ptr", "dword_ptr", "wparam"
            ; !!! Important
            If $__Au3Obj_X64 Then
                $iType &= $__Au3Obj_VT_PTR
            Else
                $iType &= $__Au3Obj_VT_UINT
            EndIf
        Case "idispatch" ; ???
            $iType &= $__Au3Obj_VT_DISPATCH
    EndSwitch

    Return $iType
EndFunc   ;==>__Au3Obj_VarType
Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Do you think I am out of luck with trying to call a method in AutoIt32 with a byRef parameter?

Thanks,

D

No, I have solution. Just to test it some more and see what others say and it will be released.

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0