AutoHotkey commands/functions as dll functions

Ask for help, how to use AHK_H, etc.
User avatar
jeeswg
Posts: 3005
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] [Expand] [Download] GeSHi © Codebox Plus

HotKeyIt
Posts: 1549
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] [Download] GeSHi © Codebox Plus

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] [Download] GeSHi © Codebox Plus

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