Looking for tutorials on AutoHotKey.dll

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
Miguel7
Posts: 177
Joined: 08 Sep 2014, 07:06

Looking for tutorials on AutoHotKey.dll

20 Jul 2017, 17:11

Hey guys,

First off, way to go, HotKeyIt! :bravo: It's totally amazing that you built your own custom version of AHK. I'm an intermediate/borderline-advanced C++ developer myself, and I know how huge a project that is. Mostly because I started something similar. I wanted to separate AHK's functionality from its scripting language. I've never seen a tool half as powerful as AHK for automation and hotkeys (as I've said before AHK rocks) but having to use a custom language, that none of my co-workers have ever heard of (apart from the boss, who introduced me to it :lol:) is kind of limiting. And it basically has 2 syntaxes, making it tough to read other people's code and opening up more room for bugs... bottom line, I really wished AHK were a library for some other language. So what did I do - and what would any code-crazed geek like me be dumb enough to do? I started to build it myself (lol)! I got some of the string functions (which C++ needs anyway IMO) and nearly 2 dozen of the built-in variables, also FileExist and MouseGetPos... and then I heard about AutoHotKey.dll. :o

But most of the documentation I've found on the subject seems to be about using the custom language again... in a language that's 99% compatible with AHK_L (!?). This makes sense, because I'm sure most users are using it that way. From what I've heard though, it's possible to use this DLL to call AHK functions from other languages (or is it)? Maybe I'm way out in left field somewhere and should get back to work on AutoHotKey_Unlocked. But if it IS possible, where do I start? I suppose I could check out the DLL with a utility like Dependency Walker or dumpbin, but that won't give me the parameters or return values. And is there a header to #include and a lib to link to (in the case of C++)? Wrapper libraries for others? I've been all over the web, and just haven't been able to find any info on the subject.

So... am I crazy or what? :) Seriously though, I would greatly appreciate any resources for this, if they exist. Thanks in advance.
HotKeyIt
Posts: 1551
Joined: 29 Sep 2013, 18:35
Contact:

Re: Looking for tutorials on AutoHotKey.dll

21 Jul 2017, 01:02

You can find source code on github, exported functions are defined here: https://github.com/HotKeyIt/ahkdll/blob ... /exports.h
There is also a COM Interface which needs to be registered first: http://hotkeyit.github.io/v2/docs/AutoHotkeyDll.htm.
A functions can be called using ahkFunction and returns always a string that you have to copy before calling ahkFunction again because internally the memory is reused on every call.
Miguel7
Posts: 177
Joined: 08 Sep 2014, 07:06

Re: Looking for tutorials on AutoHotKey.dll

21 Jul 2017, 15:54

Okay, awesome! This is exactly what I was looking for. Thanks. :)

And what a cool idea to use the DLL from the AHK_H language itself to implement multithreading! In AHK_L I wrote a class that imitated this using Post/Send/OnMessage, and I've also used stdout or files to send data between two scripts, but anytime I needed real multithreading I would usually end up using a different language. But if I were using your fork of AHK I wouldn't have had to (lol).

PS: In case anyone else with the same question, the page with the COM interface has examples in Visual Basic as well as AHK_H.

Return to “AutoHotkey_H”

Who is online

Users browsing this forum: No registered users and 1 guest