Error while Including Autohotkey.dll

Ask for help, how to use AHK_H, etc.
User avatar
Renz
Posts: 20
Joined: 05 Sep 2015, 21:56
Location: Dortmund (NRW|GER)
Contact:

Error while Including Autohotkey.dll

11 Mar 2018, 16:13

Hey :)

if i include the Autohotkey.dll with #Include, i get this error...

The Script:

Code: Select all

#Persistent
#SingleInstance force
#include %A_MyDocuments%\AutoHotkey\Lib\AutoHotkey.dll
The Error:

Code: Select all

---------------------------
test.ahk
---------------------------
Error at line 1 in #include file "C:\Users\...\Documents\AutoHotkey\Lib\AutoHotkey.dll".

Line Text: MZ
Error: This line does not contain a recognized action.

The program will exit.
---------------------------
OK   
---------------------------
anyone has an idea?
What it mean?
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Error while Including Autohotkey.dll

11 Mar 2018, 16:21

You can't include a dll, best is to use AHK_H with AutoHotkey.dll and AhkThread to launch a new thread.

Otherwise you will need to call DllCall("LoadLibrary","Str",PathToAutoHotkeyDLL,"Ptr"), and then start a thread using ahkdll or ahktextdll, see docs.
User avatar
Renz
Posts: 20
Joined: 05 Sep 2015, 21:56
Location: Dortmund (NRW|GER)
Contact:

Re: Error while Including Autohotkey.dll

11 Mar 2018, 16:37

Oh ok was wondering about that in the doc is written...
dllpath:=A_AhkDir "\AutoHotkey.dll"
DllCall("LoadLibrary","Str",dllpath) ; Load the AutoHotkey module.
DllCall(dllpath "\ahktextdll","Str","","Str","","CDecl") ; start a new thread, just the function.
DllCall(dllpath "\ahkExec","Str","MsgBox Hello World!","CDecl") ; add and execute code

; Same example like above but using included AutoHotkey.dll
dll:=AhkThread()
dll.ahkExec["MsgBox Hello World!"]

; Execute code in current thread
ahkExec("MsgBox Test")
The ; Same example like above but using included AutoHotkey.dll confusing me, Was a misstaken from me, sry about that...

But thank you for the fast answer :)

Return to “Ask for Help”

Who is online

Users browsing this forum: No registered users and 26 guests