ahkdll := AhkDllThread() ahkdll.ahktextdll() msgbox % "ahkgetvar a not existence addr is " ahkdll.ahkgetvar("nothing", 1) ; add this may induce error for the following code, You can comment it out to test the different behavior. ahkdll.addscript("tooltip addscript is ok!`n ret := true`n func(var){`nglobal`n return `%var`%`n}", 1) ; show the script is running Sleep, 1000 ahkdll.addscript("tooltip", 1) ; dismiss the tooltip msgbox % "test for ahkfunction the ret = " ahkdll.ahkfunction("func", "ret") ; this is ok MsgBox % "test for ahkgetvar ret = " ahkdll.ahkgetvar.ret ahkdll.ahkassign.ret := "222" msgbox % "test for ahkassign the ret should be 222, but actually ret = " ahkdll.ahkgetvar.ret ~VKFF::returnAnd there is maybe another bug when we terminate one ahkdll, and create a new one. Sometimes it would bring up a error message with "RegClass". This is occur in my complicated application. Don't figure out how this happen right now!

[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported
![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #46](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
Thanks, try again now.bug Report!
![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #47](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
The zip seems broken, can not normally unzip! And did see my previous request? :oops:Thanks, try again now.bug Report!
![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #48](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
All this can be done with Alias() and ahkgetvar(var, 1), so why do we need more?OK, maybe I'm not make it clear!You can already get the refference to the variable ahkgetvar(var, 1) and I do not see a way how to make it possible to return objects.
If the var we get is an object, we can return string "object" to indicate the var type and distinct it with blank var. Or we may have other function 'ahkgetvartype' or similar.
You can also use AhkStructuresand _Struct.
ahkdll := AhkDllThread() ahkdll.ahktextdll("#Persistent`nvar:={}") Alias(var,ahkdll.ahkgetvar["var",1]) MsgBox % "Var IsObject: " IsObject(var)
![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #49](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #50](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
DynaCall allows you to omit parameters, so the last used parameter will be used.
dll.ahkgetvar["var",1] dll.ahkgetvar.var ;this will be same as above because second parameter is already set to 1 dll.ahkgetvar["var",0] ; will get vars value and set second parameter to 0 so ahkgetvar.var can be used again
With regards to RegClass, can you try to reproduce the bug?
I could remove the message for the dll and just continue the execution, not sure what the impact would be.
![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #51](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
:shock:It is not a bug.
DynaCall allows you to omit parameters, so the last used parameter will be used.dll.ahkgetvar["var",1] dll.ahkgetvar.var ;this will be same as above because second parameter is already set to 1 dll.ahkgetvar["var",0] ; will get vars value and set second parameter to 0 so ahkgetvar.var can be used again
Maybe every time just use ahkgetvar("var", 0) will be safe.
It happen when I terminate and reload the ahkdll immediately. If I wait for a minute between them, it's no problem! When I got the message, the whole script will crash!With regards to RegClass, can you try to reproduce the bug?
I could remove the message for the dll and just continue the execution, not sure what the impact would be.
![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #52](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
#Include AhkDllObject.ahk AhkDll:=AhkDllObject("AutoHotkey.dll") AhkDll.ahktextdll("MsgBox MsgBox from AutoHotkey.dll") MsgBox end main threadgives an error here (when placed in a file in the same folder and dropped on to AutoHotkey.exe in the same folder):
Am I doing something wrong? Also, any more info I should provide?Error in #include file "X:\AutoHotkey_HotkeyIt\Win32w\AhkDllObject.ahk":
Duplicate declaration.
Specifically: AHK_H:=VarSetCapacity( Trans,8*(A_IsUnicode?2:1)),AHK_H:=DllCall("Version\GetFileVersionInfo", "Str"...
Line#
004: DynaCall := "DynaCall"
004: uc := "UChar"
004: ui := "UInt"
004: i := "Int"
004: s := "Str"
004: functions := "ahkKey:s|ahkFunction:s=sssssssssss|ahkPostFunction:i=sssssssssss|ahkdll:ui=sss|ahktextdll:ui=sss|ahkReady:|ahkReload:ui=|ahkTerminate:i|addFile:ui=sucuc|addScript:ui=si|ahkExec:ui=s|ahkassign:ui=ss|ahkExecuteLine:ui=uiuiui|ahkFindFunc:ui=s|ahkFindLabel:ui=s|ahkgetvar:s=sui|ahkLabel:ui=sui|ahkPause:s"
012: FSz := DllCall("Version\GetFileVersionInfoSize", "Str",A_AhkPath, "UInt",0 )
---> 012: AHK_H := VarSetCapacity( FVI, FSz, 0 )
The program will exit.
![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #53](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
Error at line 1.
#Include file "AhkDllObject.ahk" cannot be opened.
The program will exit.
![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #54](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
0419EE8A9EAE6EDEC91B30F3B6DB0BBF
![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #55](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
Sorry I have not updated the functions in the zip package, can you try the one from first post in this thread, I will update with next release.Windows 7 (64-bit), in Win32w folder (with AhkDllObject.ahk copied into Win32w folder), the following code:
#Include AhkDllObject.ahk AhkDll:=AhkDllObject("AutoHotkey.dll") AhkDll.ahktextdll("MsgBox MsgBox from AutoHotkey.dll") MsgBox end main threadgives an error here (when placed in a file in the same folder and dropped on to AutoHotkey.exe in the same folder):
Place it in your lib folder and use"#Include file "AhkDllObject.ahk" cannot be opened.
#Include <AhkDllObject>
![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #56](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
Thanks for the explanation -- looking forward to the next release...I have not updated the functions in the zip package, can you try the one from first post in this thread, I will update with next release.

I created a file named AhkDllObject.ahk and placed in it code from the first post in this thread. I also changed the line with the #Include in the sample code to use angle brackets.Place it in your lib folder and use"#Include file "AhkDllObject.ahk" cannot be opened.
#Include <AhkDllObject>
When executing the results, I got an error:
I searched the forums and found:Error at line 1 in #include file "X:\AutoHotkey_HotkeyIt\Win32w\Lib\AhkDllObject.ahk".
Line Text: #include
Error: Function library not found.
The program will exit.
http://www.autohotke...ic.php?p=233188
Then I placed the code from the first post in that thread (function definition for FileGetVersionInfo_AW minus the example code near the end) in a file named FileGetVersionInfo.ahk and placed this in the Lib directory.
Subsequent executions of the code seem to behave appropriately.
Was this a reasonable course of action?
![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #57](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
#Include <AhkDllObject>
Is this an example of:
Files can be automatically included (i.e. without having to use #Include) by calling a library function by name.
(from AHK_L's #Include documentation)?
![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #58](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
This should be now fixed (in 1.1.05.02)It happen when I terminate and reload the ahkdll immediately. If I wait for a minute between them, it's no problem! When I got the message, the whole script will crash!With regards to RegClass, can you try to reproduce the bug?
I could remove the message for the dll and just continue the execution, not sure what the impact would be.
![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #59](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
It's great! And may thanks for implementing of CriticalObjectThis should be now fixed (in 1.1.05.02)

![[AHK_H(+dll) / AHK_L / v2] AhkDllThread+AhkExported: post #60](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)