AutoHotkey.dll v2 beta release - COM issue

Ask for help, how to use AHK_H, etc.
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

AutoHotkey.dll v2 beta release - COM issue

Post by burque505 » 01 Dec 2021, 15:22

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 3087 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

User avatar
thqby
Posts: 397
Joined: 16 Apr 2021, 11:18
Contact:

Re: AutoHotkey.dll v2 beta release - COM issue

Post by thqby » 05 Dec 2021, 08:53

@burque505
Personal modification compiled version.
Github

burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: AutoHotkey.dll v2 beta release - COM issue

Post by burque505 » 05 Dec 2021, 09:26

@thqby, thanks, I'll try it!
Regards,
burque505

EDIT: Missing ahktextdll

User avatar
thqby
Posts: 397
Joined: 16 Apr 2021, 11:18
Contact:

Re: AutoHotkey.dll v2 beta release - COM issue

Post by thqby » 05 Dec 2021, 11:01

v2: HRESULT NewThread([in, optional]VARIANT script, [in, optional]VARIANT params, [in, optional]VARIANT title, [out, retval]DWORD* ThreadID);

burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: AutoHotkey.dll v2 beta release - COM issue

Post by burque505 » 05 Dec 2021, 11:20

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!

User avatar
thqby
Posts: 397
Joined: 16 Apr 2021, 11:18
Contact:

Re: AutoHotkey.dll v2 beta release - COM issue

Post by thqby » 05 Dec 2021, 11:33

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.

burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: AutoHotkey.dll v2 beta release - COM issue

Post by burque505 » 05 Dec 2021, 11:46

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   
---------------------------


User avatar
thqby
Posts: 397
Joined: 16 Apr 2021, 11:18
Contact:

Re: AutoHotkey.dll v2 beta release - COM issue

Post by thqby » 05 Dec 2021, 12:03

image.png
image.png (39.14 KiB) Viewed 2855 times
running in v2 beta.3

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

burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: AutoHotkey.dll v2 beta release - COM issue

Post by burque505 » 05 Dec 2021, 12:15

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 2837 times
errors.PNG
errors.PNG (7.71 KiB) Viewed 2837 times
EDIT: 32-bit works. 64-bit does not.

User avatar
thqby
Posts: 397
Joined: 16 Apr 2021, 11:18
Contact:

Re: AutoHotkey.dll v2 beta release - COM issue

Post by thqby » 05 Dec 2021, 12:21

throw this error in 64bit, but work fine in 32bit.

User avatar
thqby
Posts: 397
Joined: 16 Apr 2021, 11:18
Contact:

Re: AutoHotkey.dll v2 beta release - COM issue

Post by thqby » 05 Dec 2021, 12:49

I probably know the reason. The method parameters are not defined correctly

burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: AutoHotkey.dll v2 beta release - COM issue

Post by burque505 » 05 Dec 2021, 12:54

Thanks for all your work on this. I'm looking forward to seeing more!
Regards,
burque505

User avatar
thqby
Posts: 397
Joined: 16 Apr 2021, 11:18
Contact:

Re: AutoHotkey.dll v2 beta release - COM issue

Post by thqby » 05 Dec 2021, 21:51

The fixed version has been released.@burque505

burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: AutoHotkey.dll v2 beta release - COM issue

Post by burque505 » 07 Dec 2021, 09:16

@thqby, thank you, I will try it out.

Post Reply

Return to “Ask for Help”