Page 1 of 1

AutoHotkey.dll v2 beta release - COM issue

Posted: 01 Dec 2021, 15:22
by burque505
Hi, I downloaded ahkdll-v2beta-release-master.zip from somewhere in September, but I can no longer find a link to that beta release.
At the moment I have ahkdll-v2 alpha registered for COM, and use it via "ComObjCreate("AutoHotkey2.Script") without issues.
The beta release that I have (maybe not up to date? Timestamp 31 Aug 2021 at 23:48) seems to be missing the COM-related functions, no entry point. Here are the only functions dllexp.exe shows:
beta-1 funcs.PNG
beta-1 funcs.PNG (4.08 KiB) Viewed 3267 times
Obviously, regsvr32 fails on this DLL.
Am I missing something?
Also, if there could be a link somewhere on the forum to the beta release it would be nice (maybe it's there somewhere?).
Thanks very much!
Regards,
burque505

Re: AutoHotkey.dll v2 beta release - COM issue

Posted: 05 Dec 2021, 08:53
by thqby
@burque505
Personal modification compiled version.
Github

Re: AutoHotkey.dll v2 beta release - COM issue

Posted: 05 Dec 2021, 09:26
by burque505
@thqby, thanks, I'll try it!
Regards,
burque505

EDIT: Missing ahktextdll

Re: AutoHotkey.dll v2 beta release - COM issue

Posted: 05 Dec 2021, 11:01
by thqby
v2: HRESULT NewThread([in, optional]VARIANT script, [in, optional]VARIANT params, [in, optional]VARIANT title, [out, retval]DWORD* ThreadID);

Re: AutoHotkey.dll v2 beta release - COM issue

Posted: 05 Dec 2021, 11:20
by burque505
I guess I'm not up to speed on this.
Might I ask how I would convert the script below to use your DLL? This is using the January 2021 version of AHK Dll v. 2.

Code: Select all

ahk := ComObjCreate("AutoHotkey2.Script")
ahk.ahktextdll("")
ahk.ahkexec("#Persistent`nMsgbox(""Hello AHK"") ")

;~ while (ahk.ahkReady()) {
	;~ sleep 100
;~ }
ahk.ahkTerminate()
Thanks!

Re: AutoHotkey.dll v2 beta release - COM issue

Posted: 05 Dec 2021, 11:33
by thqby

Code: Select all

ahk := ComObject("AutoHotkey2.Script")
threadid := ahk.NewThread("Persistent`nMsgbox(`"Hello AHK`") ")
; threadid := ahk.NewThread("Persistent ")
; ahk.ahkExec(threadid, "Msgbox(`"Hello AHK`")")

while (!ahk.ahkReady(threadid)) {
	sleep 100
}
ahk.ahkPostFunction(threadid,'exitapp')  ; ahkFunction(threadid, 'exitapp') will block the calling thread.

Re: AutoHotkey.dll v2 beta release - COM issue

Posted: 05 Dec 2021, 11:46
by burque505
I'm trying to access a V2 COM object from AHK v1. That won't work for v1.
I get this error when I run that using AHK V2-beta1:

Code: Select all

---------------------------
test3.ahk
---------------------------
Error:  (0x8002000E) Invalid number of parameters.

Specifically: ahkReady

	Line#
	001: ahk := ComObject("AutoHotkey2.Script")
	002: threadid := ahk.NewThread("Persistent
Msgbox("Hello AHK") ")
--->	006: While (!ahk.ahkReady(threadid))
	006: {
	007: sleep(100)
	008: }
	009: ahk.ahkPostFunction(threadid,'exitapp')
	010: Exit

Try to continue anyway?
---------------------------
Yes   No   
---------------------------


Re: AutoHotkey.dll v2 beta release - COM issue

Posted: 05 Dec 2021, 12:03
by thqby
image.png
image.png (39.14 KiB) Viewed 3035 times
running in v2 beta.3

The number of ahkready parameters is wrong in V1, and the other methods seem to work normally.

Re: AutoHotkey.dll v2 beta release - COM issue

Posted: 05 Dec 2021, 12:15
by burque505
Not sure what's happening for me. This is using AutoHotkey64.exe just downloaded from your github page. Same script I just copied from your post.
run from command line.PNG
run from command line.PNG (1.56 KiB) Viewed 3017 times
errors.PNG
errors.PNG (7.71 KiB) Viewed 3017 times
EDIT: 32-bit works. 64-bit does not.

Re: AutoHotkey.dll v2 beta release - COM issue

Posted: 05 Dec 2021, 12:21
by thqby
throw this error in 64bit, but work fine in 32bit.

Re: AutoHotkey.dll v2 beta release - COM issue

Posted: 05 Dec 2021, 12:49
by thqby
I probably know the reason. The method parameters are not defined correctly

Re: AutoHotkey.dll v2 beta release - COM issue

Posted: 05 Dec 2021, 12:54
by burque505
Thanks for all your work on this. I'm looking forward to seeing more!
Regards,
burque505

Re: AutoHotkey.dll v2 beta release - COM issue

Posted: 05 Dec 2021, 21:51
by thqby
The fixed version has been released.@burque505

Re: AutoHotkey.dll v2 beta release - COM issue

Posted: 07 Dec 2021, 09:16
by burque505
@thqby, thank you, I will try it out.