amazing-andrew/AutoHotkey.Interop

"To use, just include my DLL and it will deploy any files that are missing if needed." - not working

jaredbaszler opened this issue · 2 comments

So I'm attempting to implement your DLL which sounds easy but I cannot get it to work within my own c# .NET Winforms project.

I've downloaded your example solution and that is running just fine. It compiles, runs and works just as you'd expect.

I've try taking the DLL at this location:

AutoHotkey.Interop-master\AutoHotkey.Interop-master\src\AutoHotkey.Interop\bin\Debug\AutoHotkey.Interop.dll

and add that to my project. It adds just fine but when I try this line:

var ahk = AutoHotkey.Interop.AutoHotkeyEngine();

I get a compilation error that is attached. Please advise.

autohotkey interop error

The only differences I can see between my project and your example project is in the object browser.

Your example project looks like this:

autohotkey interop object browser-good

My project seems to be missing things:

autohotkey interop object browser-bad

I also went as far as adding your entire AutoHotkey.Interop proect to my project and referencing the project itself. That also did not work. Same compilation error.

it looks like you need to use a new operator when you are creating a new AutoHotkeyEngine.

change your line from this:
var ahk = AutoHotkey.Interop.AutoHotkeyEngine();

to this:
var ahk = new AutoHotkey.Interop.AutoHotkeyEngine();

Also note that AutoHotkeyEngine is not threadsafe and that you should ever only create one AutoHotkeyEngine for your entire application, it currently does not support creating multiple instances of the engine.


Also you see less classes available to you as a user of the library because I used accessibility levels to limit the users of the library to only the things I thought was important. Scroll through my source code and you'll see that the AutoHotkeyEngine class is public, and most of the other classes and method definitions are either internal or private.

good luck, hope this helps.

Just call me stupid! I respect your constraint not to with your response. Thanks for the prompt response and making this library available.