I am trying to load a DLL using ctypes
in order to run some functions from the ASWHook.dll
file that comes with the old AutoHotKey AutoScriptWriter. I am able to use a program to view the function names, but I cannot figure out why ctypes
is crashing when I try to call a function. I'm guessing it's because the functions need parameters, but the program I'm using doesn't tell you any of that information. The program I'm using is called "DLL Export Viewer"
The function I'm trying to call is called GetKeyInfo
, and this is what I'm doing in my script.
import ctypes
d = ctypes.WinDLL ("C:\\Users\\Username\\Desktop\\AHK\\AutoScriptWriter\\ASWHook.dll")
f = d['GetKeyInfo']
v = f()
This causes the python interpreter to freeze and then restart. I'm not sure if GetKeyInfo
takes any parameters, but either way, it's crashing when I try to use it. Is there a better way to inspect the DLL in order to get more information about what parameters the functions take?
Sorry if this is simple stuff, I'm new to using DLLs in general, so I'm not exactly sure.
I was looking at this answer on how to use the DLLs, but it was really confusing.
I'm working off this example now.