Build in function, similar to DllCall but works with DllCall structures and Object syntax.
It is faster than DllCall, easier to use and saves a lot of typing and code.
objfunc:=DynaCall(FilePath . "\function",[parameter_definition,default_param1,default_param2,...])
objfunc.[DllCallReturnType](params...)
| Parameter | Description |
| function | Can be a function address, name of function or path\name for the function. |
| parameter_definition | Int = i / Str = s / AStr = a / WStr = w / Short = h / Char = c / Float = f / Double = d / Ptr = t / Int64 = 6 |
| default_param | You can set the parameters already when a Token is created, that way you can call the function without passing parameters as these are alredy set. When default_value is not given, parameters will default to 0 or "". |
| DllCall_Return_Type | Optional. Using this you can override default return type previously defined in parameter_definition. |
| How to call the function | Any Object syntax can be used to call the function. For example: |
DynaCall uses same ErrorLevel as DllCall.
DynaCall can be also used to call the function, therefore pass a DynaToken that was created via DynaCall previously, followed by parameters. E.g. DynaCall(objfunc,parameters...).
AutoHotkey.dll, ahkdll, ahktextdll, ahkReady, addFile, addScript, ahkExec, ahkLabel, ahkFunction, ahkPostFunction, ahkassign, ahkgetvar, ahkTerminate, ahkReload, ahkFindFunc, ahkFindLabel, ahkPause, ahkExecuteLine, Alias, cacheEnable, FindFunc, FindLabel, getTokenValue, getVar, Static, AutoHotkeyMini, CriticalSection, CriticalObject, MemoryLoadLibrary, ResourceLoadLibrary, MemoryGetProcAddress, MemoryFreeLibrary, Other Changes
SetWorkingDir % A_ScriptDir
DllCall("LoadLibrary","Str",dll:="AutoHotkey.dll") ;Load AutoHotkey.dll
;Create an Object that will hold all DllCall Tokens
ahk:=Object( "run1",DynaCall(dll . "\ahktextdll","ui=sss","MsgBox run1")
,"run2",DynaCall(dll . "\ahktextdll","ui=sss","MsgBox run2")
,"get",DynaCall(dll . "\ahkgetvar","s=sui","a")
,"set",DynaCall(dll . "\ahkassign","ui=ss") )
ahk.run1() ;run ahktextdll with default paramers (here first parameter was set when run1 was created
ahk.set.a := "test" ;same as ahk.set("a","test") or ahk.set["a","test"]
MsgBox % ahk.get() ;get variable a, first parameter was set to "a" when get was created
ahk.run2() ;same as run1 but a different DynaCall object
ahk.set.a := "var"
MsgBox % ahk.get.a ;"a" will be passed as parameter to get (this is only possible with 1 parameter)
MsgBox % ahk.get["a"] "`n" ahk.get("a") ;same as above
;---------------------------------------------------------
ms := new _MouseSpeed
ms.get[OrigMouseSpeed] ; get origial mouse speed
InputBox,NewSpeed,Enter New Mouse Speed,Current Speed: %OrigMouseSpeed%
ms.set[NewSpeed] ; set/write new speed
ms.get[OrigMouseSpeed] ; get/read new speed
MsgBox New Speed was changed to %OrigMouseSpeed%
Class _MouseSpeed {
Get:=DynaCall("SystemParametersInfo",["uiuiui*ui",3],SPI_GETMOUSESPEED := 0x70)
Set:=DynaCall("SystemParametersInfo",["uiuitui",3],SPI_SETMOUSESPEED := 0x71)
}