Jump to content
Sign in to follow this  
BugFix

AutoItObject -- call methode with parameter ByRef?

Recommended Posts

BugFix

Hi,

i have a problem with

I want to call a methode with one or more parameter as ByRef. Inside the methode it works properly, but the ByRef-variable itself will not change value.

Any ideas?

#include <AutoItObject.au3>

_AutoItObject_Startup()

$oTest = _CreateObjFunc('Test')

$a1 = 5
ConsoleWrite('Return Methode                 = ' & $oTest.Meth($a1, 3, 5) & ' [OK]' & @LF)
ConsoleWrite('ByRef "$a1" after methode-call = ' & $a1 & ' [FAIL]' & @LF) ; == parameter $a1 was changed inside methode - but $a1 is'nt changed after call

;------------------------------------- OBJECT ------------------------------------------------------
Func _CreateObjFunc($_sName)
Local $oSelf = _AutoItObject_Create()
_AutoItObject_AddMethod($oSelf, 'Meth', "_Meth")
Return $oSelf
EndFunc

Func _Meth(ByRef $oSelf, ByRef $A, $B, $C)
$A += $B + $C
Return $A
EndFunc
;---------------------------------------------------------------------------------------------------

Best Regards BugFix  

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  

×