genius257 / autoitobject-internal Goto Github PK
View Code? Open in Web Editor NEWProvides object creation via IDispatch interface
License: MIT License
Provides object creation via IDispatch interface
License: MIT License
code for tests https://pastebin.com/iahENe7v
access to variable take 100x longer than to AutoItObject UDF
and 780x longer than to simple Variable
result:
Variable cycle 10k => 1.991 ms || _console_time
Variable one => 0.006 ms || _console_time
AutoItObject UDF FirstObj cycle 10k => 15.763 ms || _console_time
AutoItObject UDF FirstObj one => 0.008 ms || _console_time
AutoItObject UDF SecondObj cycle 10k => 15.696 ms || _console_time
AutoItObject UDF SecondObj one => 0.006 ms || _console_time
AutoItObject Internal cycle 10k => 1554.424 ms || _console_time
AutoItObject Internal one => 0.162 ms || _console_time
a __has method for the IDispatch object, to check if an object has a key, instead of using __get and either creating the key or producing a COM error if the object is frozen.
Event sink support would be great, allowing AutoIt3 to use ObjEvent with the objects.
As an alternative, a extension of the script, either as a new repository or an extra file with the Event sink availability on the IDispatch objects.
#include "AutoItObject_Internal.au3"
$oIDispatch = IDispatch()
$oIDispatch.a = "a"
$oIDispatch.b = "b"
ConsoleWrite($oIDispatch()&@CRLF); a
A fix would be looking for a property with name as empty string, if id 0 is received.
Function for property lookup need to modify return index +1
#include "AutoItObject_Internal.au3"
For $i=0 To 10000
ConsoleWrite($i&@CRLF)
$o = IDispatch()
Next
On my test PC, around "8958" AutoIt crashes.
AutoIt3.exe ended.rc:-1073741819
The issue itself is with AutoIt3 itself, but AutoItObject-Internal can avoid it, mostly.
A solution may be to change the way the default parameters in the IDispatch function are used. Instead of calling DllCallbackRegister every time, the defaults should only be created once internally in the function Local Static $...
and used that way instead.
To also reduce this issue for cases with custom parameters, maybe check if variable is int (Int32 is the return type from a DllCallbackRegister call) or a Ptr (the return type from DllCallbackGetPtr) and use them instead.
like php's class magic methods:__get and __set
https://www.php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.members
Or like ES6 Proxies https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy
This AutoIt3 project uses FnvHash
for display id lookup names.
This MAY be faster then the current solution, if the general loop speed related issues of AutoIt3 does not cause FnvHash
to be slower.
Related to #10
Would be nice to could write
...
$oFoo2=$oFoo1.clone
...
Example
how it works at the moment (which in general is fine but would be nice to quickly clone) is that a var references another object where you sometimes want a copy/clone
#include <AutoItObject_Internal.au3>
$cFoo=IDispatch()
$oFoo1=$cFoo
$oFoo2=$cFoo
$oFoo1.Property1="Nice"
;~ And now the fun comes as they both point to same object
consolewrite($oFoo2.Property1)
Endgoal I would like to reach is that you have
;~ Have a generic method reference that is shared
$cFoo.Method1 = cFoo_Method1
func cFoo_Method1
;~ whatever we want to have shared as a method printing a property of the current object
ConsoleWrite($self.parent.Property1)
endfunc
$oFoo1=cFoo.clone
$oFoo2=cFoo.clone
;~ Have independent propertyvalues
$oFoo1.Property1="Hello world 1"
$oFoo2.Property1="Hello world 2"
$oFoo1.Method1
$oFoo2.Method1
MSDN docs:
https://docs.microsoft.com/en-us/cpp/atl/queryinterface?view=msvc-160
QueryInterface retrieves a pointer to the interface, while also calling AddRef.
This may be one on the reasons why ROT related actions resulted in Ref imbalance.
Hello,
Funny thing, i did run it once - it workd, i compiled it once - it workd.
Then i tried to run it again, and this happens now everytime i try to run it:
`"C:\Users\ataltambanis\Desktop\Autoit 3\Projekte\GITHUB\Internal-Framework\Framework#unused yet\AutoItObject-Internal\AutoItObject_Internal.au3"(20,63) : error: $S_OK previously declared as a 'Const'.
If Not IsDeclared("S_OK") Then Global Const $S_OK = 0x00000000
"C:\Users\ataltambanis\Desktop\Autoit 3\Projekte\GITHUB\Internal-Framework\Framework\#unused yet\AutoItObject-Internal\AutoItObject_Internal.au3"(21,73) : error: $E_NOTIMPL previously declared as a 'Const'.
If Not IsDeclared("E_NOTIMPL") Then Global Const $E_NOTIMPL = 0x80004001
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\ataltambanis\Desktop\Autoit 3\Projekte\GITHUB\Internal-Framework\Framework\#unused yet\AutoItObject-Internal\AutoItObject_Internal.au3"(22,81) : error: $E_NOINTERFACE previously declared as a 'Const'.
If Not IsDeclared("E_NOINTERFACE") Then Global Const $E_NOINTERFACE = 0x80004002
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\ataltambanis\Desktop\Autoit 3\Projekte\GITHUB\Internal-Framework\Framework\#unused yet\AutoItObject-Internal\AutoItObject_Internal.au3"(23,73) : error: $E_POINTER previously declared as a 'Const'.
If Not IsDeclared("E_POINTER") Then Global Const $E_POINTER = 0x80004003
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\ataltambanis\Desktop\Autoit 3\Projekte\GITHUB\Internal-Framework\Framework\#unused yet\AutoItObject-Internal\AutoItObject_Internal.au3"(24,69) : error: $E_ABORT previously declared as a 'Const'.
If Not IsDeclared("E_ABORT") Then Global Const $E_ABORT = 0x80004004
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\ataltambanis\Desktop\Autoit 3\Projekte\GITHUB\Internal-Framework\Framework\#unused yet\AutoItObject-Internal\AutoItObject_Internal.au3"(25,67) : error: $E_FAIL previously declared as a 'Const'.
If Not IsDeclared("E_FAIL") Then Global Const $E_FAIL = 0x80004005
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\ataltambanis\Desktop\Autoit 3\Projekte\GITHUB\Internal-Framework\Framework\#unused yet\AutoItObject-Internal\AutoItObject_Internal.au3"(26,83) : error: $E_ACCESSDENIED previously declared as a 'Const'.
If Not IsDeclared("E_ACCESSDENIED") Then Global Const $E_ACCESSDENIED = 0x80070005
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\ataltambanis\Desktop\Autoit 3\Projekte\GITHUB\Internal-Framework\Framework\#unused yet\AutoItObject-Internal\AutoItObject_Internal.au3"(27,71) : error: $E_HANDLE previously declared as a 'Const'.
If Not IsDeclared("E_HANDLE") Then Global Const $E_HANDLE = 0x80070006
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\ataltambanis\Desktop\Autoit 3\Projekte\GITHUB\Internal-Framework\Framework\#unused yet\AutoItObject-Internal\AutoItObject_Internal.au3"(28,81) : error: $E_OUTOFMEMORY previously declared as a 'Const'.
If Not IsDeclared("E_OUTOFMEMORY") Then Global Const $E_OUTOFMEMORY = 0x8007000E
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\ataltambanis\Desktop\Autoit 3\Projekte\GITHUB\Internal-Framework\Framework\#unused yet\AutoItObject-Internal\AutoItObject_Internal.au3"(29,79) : error: $E_INVALIDARG previously declared as a 'Const'.
If Not IsDeclared("E_INVALIDARG") Then Global Const $E_INVALIDARG = 0x80070057
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\ataltambanis\Desktop\Autoit 3\Projekte\GITHUB\Internal-Framework\Framework\#unused yet\AutoItObject-Internal\AutoItObject_Internal.au3"(30,79) : error: $E_UNEXPECTED previously declared as a 'Const'.
If Not IsDeclared("E_UNEXPECTED") Then Global Const $E_UNEXPECTED = 0x8000FFFF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\ataltambanis\Desktop\Autoit 3\Projekte\GITHUB\Internal-Framework\Framework\#unused yet\AutoItObject-Internal\AutoItObject_Internal_Example.au3 - 11 error(s), 0 warning(s)`
Edit: i tried to run it now again multiple times, and it workd again, haha.
Solution would be almost this:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.