MemoryGetProcAddress


Build in function to get a pointer to exported functions of a dll to use in DllCall().
Based on http://www.joachim-bauch.de/tutorials/load_dll_memory.html

pFunc:=MemoryGetProcAddress(hLibrary,"function")

Parameters

Parameter

Description

hLibrary

The handle returned by MemoryLoadLibrary().

function

Function to get the pointer for.

Return Value

Returns a pointer to the function that can be used in DllCall().

Remarks

You can access these functions only by using pointer in DllCall!

Related

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, DynaCall, CriticalSection, CriticalObject, MemoryLoadLibrary, ResourceLoadLibrary, MemoryFreeLibrary, Other Changes

Example

SetWorkingDir % A_ScriptDir
; Similar to DllCall("LoadLibrary",...)
dll:=MemoryLoadLibrary("AutoHotkey.dll")

; Similar to DllCall("GetProcAddress",...)
ahktextdll:=MemoryGetProcAddress(dll,"ahktextdll")
ahkTerminate:=MemoryGetProcAddress(dll,"ahkTerminate")

; Call exported function
DllCall(ahktextdll,"Str","MsgBox","Str","","Str","","Cdecl UInt")
MsgBox Thread running
DllCall(ahkTerminate,"Int",0) ;exit thread
; Free Library from Memory
MemoryFreeLibrary(dll)