AutoHotkey commands/functions as dll functions

Ask for help, how to use AHK_H, etc.
User avatar
jeeswg
Posts: 5148
Joined: 19 Dec 2016, 01:58
Location: UK

AutoHotkey commands/functions as dll functions

12 Nov 2017, 15:04

- I was wondering if it was possible to use any of the AutoHotkey functions/commands as dll functions that you could call via DllCall.
- Basically, I had in mind to use the InputBox function/command from within C++. So no worries if it isn't possible.
- (If anyone happened to have any recommendations for how to get an InputBox in C++ that would be great. You can use the Winapi MessageBox function, to get a MsgBox.)
- I checked which dll functions were available in AutoHotkeyMini.dll, but none of them corresponded to AutoHotkey functions/commands. Cheers.

Code: Select all

;[get x64 and x32 versions of AutoHotkeyMini.dll]
;GitHub - HotKeyIt/ahkdll-v1-release: AutoHotkey_H v1 release
;https://github.com/HotKeyIt/ahkdll-v1-release

;DllListExports() - List of Function exports of a DLL - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=4563

q::
vDll := "C:\Program Files\AutoHotkey\AutoHotkeyMini.dll"
Clipboard := StrReplace(DllListExports(vDll), "`n", "`r`n") "`r`n"
return
HotKeyIt
Posts: 1697
Joined: 29 Sep 2013, 18:35
Contact:

Re: AutoHotkey commands/functions as dll functions

12 Nov 2017, 17:15

You can call ahkFunction:

Code: Select all

dll:=AhkThread("
(
#Persistent
InputBox(Title:="""",Prompt:="""", HIDE:="""", Width:="""", Height:="""", X:="""", Y:="""", Font:="""", Timeout:="""", Default:=""""){
  InputBox,var,`% Title,`% Prompt,`% HIDE,`% Width,`% Height,`% X,`% Y, ,`% Timeout,`% Default
  return var
}
)")
MsgBox % dll.ahkFunction("InputBox","Test","Type something")
But you can also use ahkExec to run a command and then read output variable:

Code: Select all

dll:=AhkThread("#Persistent")
dll.ahkExec("InputBox,var,Test,Type something")
MsgBox % dll.ahkgetvar.var

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 3 guests