Skip to content

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
Fixed missing Local specification within Invoke
  • Loading branch information
genius257 committed Aug 6, 2017
1 parent 13db9f2 commit a751df4
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 6 deletions.
6 changes: 3 additions & 3 deletions AutoItObject_Internal.au3
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#cs ----------------------------------------------------------------------------
AutoIt Version : 3.3.14.2
Author.........: genius257
Version........: 1.0.0
Version........: 1.0.1
#ce ----------------------------------------------------------------------------

#include-once
Expand Down Expand Up @@ -441,7 +441,7 @@ Func Invoke($pSelf, $dispIdMember, $riid, $lcid, $wFlags, $pDispParams, $pVarRes
If (Not(BitAND($wFlags, $DISPATCH_PROPERTYGET)=0)) Then
$_tVARIANT = DllStructCreate($tagVARIANT, $pVarResult)
If Not($tProperty.__getter = 0) Then
$oIDispatch = IDispatch()
Local $oIDispatch = IDispatch()
$oIDispatch.val = 0
$oIDispatch.ret = 0
$oIDispatch.parent = ObjCreateInterface($pSelf,$IID_IDispatch)
Expand Down Expand Up @@ -470,7 +470,7 @@ Func Invoke($pSelf, $dispIdMember, $riid, $lcid, $wFlags, $pDispParams, $pVarRes
Else
$tDISPPARAMS = DllStructCreate($tagDISPPARAMS, $pDispParams)
If Not ($tProperty.__setter=0) Then
$oIDispatch = IDispatch()
Local $oIDispatch = IDispatch()
$oIDispatch.val = 0
$oIDispatch.ret = 0
$oIDispatch.parent = ObjCreateInterface($pSelf,$IID_IDispatch)
Expand Down
49 changes: 49 additions & 0 deletions AutoItObject_Internal_Example.au3
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include <WINAPI.au3>
#include "AutoItObject_Internal.au3"

;~ #AutoIt3Wrapper_UseX64=Y
;~ #AutoIt3Wrapper_Run_Au3Check=N

$AutoItError = ObjEvent("AutoIt.Error", "ErrFunc") ; Install a custom error handler

Func ErrFunc($oError)
ConsoleWrite("!>COM Error !"&@CRLF&"!>"&@TAB&"Number: "&Hex($oError.Number,8)&@CRLF&"!>"&@TAB&"Windescription: "&StringRegExpReplace($oError.windescription,"\R$","")&@CRLF&"!>"&@TAB&"Source: "&$oError.source&@CRLF&"!>"&@TAB&"Description: "&$oError.description&@CRLF&"!>"&@TAB&"Helpfile: "&$oError.helpfile&@CRLF&"!>"&@TAB&"Helpcontext: "&$oError.helpcontext&@CRLF&"!>"&@TAB&"Lastdllerror: "&$oError.lastdllerror&@CRLF&"!>"&@TAB&"Scriptline: "&$oError.scriptline&@CRLF)
EndFunc ;==>ErrFunc

$oItem = IDispatch()

$oItem.a = "a"
$oItem.b = "b"
$oItem.c = "c"
$oItem.z = "z"

$oItem.__unset("z")

$oItem.__defineGetter('a',Getter)
$oItem.__defineSetter('a',Setter)

$oItem.ab = $oItem.a&$oItem.b
$oItem.abc = $oItem.a&$oItem.b&$oItem.c
$oItem.abc = $oItem.abc&$oItem.abc

$oItem.f = Test
Execute("($oItem.f)('a')");we use execute, due to Au3Check bug. For more, see: https://www.autoitscript.com/trac/autoit/ticket/3560
MsgBox(0, "", "a: "&$oItem.a&@CRLF&"b: "&$oItem.b&@CRLF&"c: "&$oItem.c&@CRLF&"ab: "&$oItem.ab&@CRLF&"abc: "&$oItem.abc)
$oItem.f = MsgBox
Call($oItem.f,0,"","test")

$oItem.__lock();locking the object

$oItem.z = "z"; this will fail because of lock, see console. Also @error is set to non zero

Func Test($string)
MsgBox(0, "UserFunction: Test", $string)
EndFunc

Func Getter($oThis)
Return $oThis.val&$oThis.parent.b
EndFunc

Func Setter($oThis)
$oThis.val=$oThis.ret
EndFunc
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,31 @@ Provides object creation via IDispatch interface in an attempt to add more OOP t
**Things to be added:**
* Garbage collection
* ~Method support~ **_Added in v0.1.2_**
* Support for more/all AutoIt variable-types
* Accessors
* ~Support for more/all AutoIt variable-types~ **_Added in v1.0.0_**
* ~Accessors~ **_Added in v0.1.0_**
* Inheritance
* equivalent of @error and @extended
* ~equivalent of @error and @extended~ **_Added in v1.0.0_**

`__defineGetter("property", Function)`

set the get accessor


`__defineSetter("property", Function)`

set the set accessor


~~`__defineMethod("Property", "Function")`~~ deprecated in v1.0.0

~~Set a function as a property value~~


`__unset("property")`

delete a property from the object


`__lock()`

prevents creation/changing of any properties, except values in already defined properties. To prevent value change of a property, use `__defineSetter`

0 comments on commit a751df4

Please sign in to comment.