Custom COM Objects & DLL Library compilation?

Propose new features and changes
sancarn
Posts: 224
Joined: 01 Mar 2016, 14:52

Custom COM Objects & DLL Library compilation?

17 Aug 2016, 18:08

I'm not sure if either of these things are possible or within the scope of what the developers want AHK to be but:

------------------------------------------------------------------------------

1. Custom COM Objects

Currently we can create COM objects of Excel, Word etc., which are examples of where COM is used to automate applications. However COM is also used to help programming in general (e.g. Scripting.Dictionary). My first wish would be to give AHK developers the means to create these custom scripting libraries for ourselves (i.e. Allow developers to create COM libraries, which can be used from other programming languages e.g. VBA).

2. Compile to DLL Function Libraries

On a similar topic as above, a lot of the time I work in languages that don't actually support objects, however they do support DLL calls. Example in MapBasic:

Code: Select all

Declare Method RegionalLongDate Class "MBExtensions.MBDateAndTime" Lib "MBExtensions.dll" (ByVal sDateString as string) as string
It would be nice if we could compile AHK to DLLs where we could use class methods in a similar fashion. Currently I believe we can create DLLs as resource files but we cannot call functions from those DLLs.

------------------------------------------------------------------------------
Last edited by sancarn on 18 Aug 2016, 02:03, edited 1 time in total.
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Custom COM Objects & DLL Library compilation?

18 Aug 2016, 17:51

Your requests are outside the scope of what I want AutoHotkey to be. However, AutoHotkey is open source, so anyone with the right skills and/or dedication can implement those things if desired.

No. 1 is probably already possible by creating an out-of-process COM server with DllCall. I'm not sure whether it's been done, though. Scripts can register objects with ObjRegisterActive to be retrieved by other processes calling GetActiveObject or equivalent.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Custom COM Objects & DLL Library compilation?

20 Aug 2016, 09:44

You can compile AutoHotkey.dll and use it in another program (inluded compiler must be used!).
You will need to LoadLibrary, then call the function ahkdll to start script and then use other exported function, see http://hotkeyit.github.io/v2/docs/AutoHotkeyDll.htm.
AutoHotkey.dll supports COM too, also when compiled, see http://hotkeyit.github.io/v2/docs/COMInterface.htm.

Simple example for compiled AutoHotkey.dll

Code: Select all

#Persistent
fun(a,b){
  return a+b
}
Call the dll (v1):

Code: Select all

ahk:=ComObjCreate("AutoHotkey.Script")
ahk.ahkdll()
MsgBox % ahk.ahkFunction("fun",2,3)
ahk.ahkterminate(), ahk:="" ; exit
-_+
Posts: 70
Joined: 06 Dec 2014, 12:43

Re: Custom COM Objects & DLL Library compilation?

07 Sep 2016, 07:43

HotKeyIt, multiple recent MS decisions/actions push a lot of users away from Windows, some of them migrate (or want to migrate) to Linux-based OSes.
We already know lexikos' stance on the question, but we don't know yours.
Could you port your AHK_Hv2 to linux?
-_+
Posts: 70
Joined: 06 Dec 2014, 12:43

Re: Custom COM Objects & DLL Library compilation?

11 Sep 2016, 06:15

Okay, thank you.

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 18 guests