Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Using AutoHotkey.dll in vb.net


  • Please log in to reply
15 replies to this topic
wickss
  • Members
  • 19 posts
  • Last active: Oct 18 2008 11:56 PM
  • Joined: 08 Jun 2007
I am trying to use AutoHotkey.dll in VB.net. I have registered it with regsvr32. From the IDE I go to Project>Add Reference. It is not listed under the COM tab. When I browse to the dll and try to add it, I get the message, "A reference to 'X:\AutoHotkey.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."

Any ideas?

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Does it work from AHK?
dll:=ComObjCreate("AutoHotkey.Script")
dll.ahktextdll("MsgBox MsgBox from thread")
MsgBox end


wickss
  • Members
  • 19 posts
  • Last active: Oct 18 2008 11:56 PM
  • Joined: 08 Jun 2007

Does it work from AHK?

dll:=ComObjCreate("AutoHotkey.Script")
dll.ahktextdll("MsgBox MsgBox from thread")
MsgBox end


Error on the first line. Call to a non-existent function.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
You need to use AutoHotkey_L or AutoHotkey_H.

  • Guests
  • Last active:
  • Joined: --
Now it say "Invalid class string" in both AutoHokey_L and AutoHotkey_H.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Are you on Win7?

wickss
  • Members
  • 19 posts
  • Last active: Oct 18 2008 11:56 PM
  • Joined: 08 Jun 2007
Yes

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
This is probably UAC, can you run as administrator or try using ComObjDll() in AutoHotkey_H.
lib:=DllCall("LoadLibrary","Str","AutoHotkey.dll","PTR")

dll:=ComObjDll(lib,"{C00BCC8C-5A04-4392-870F-20AAE1B926B2}") ; AutoHotkey.dll v1.1 Default


wickss
  • Members
  • 19 posts
  • Last active: Oct 18 2008 11:56 PM
  • Joined: 08 Jun 2007
Running as administrator produces the same error. However the second bit of code runs uneventfully.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
So does the code run?
lib:=DllCall("LoadLibrary","Str","AutoHotkey.dll","PTR")
dll:=ComObjDll(lib,"{C00BCC8C-5A04-4392-870F-20AAE1B926B2}") ; AutoHotkey.dll v1.1 Default
dll.ahktextdll("MsgBox Thread")
MsgBox End


wickss
  • Members
  • 19 posts
  • Last active: Oct 18 2008 11:56 PM
  • Joined: 08 Jun 2007
It ends prematurely without displaying the msgbox. It doesn't give me an error message.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Can you check where it fails?
MsgBox % lib:=DllCall("LoadLibrary","Str","AutoHotkey.dll","PTR")
MsgBox % IsObject(dll:=ComObjDll(lib,"{C00BCC8C-5A04-4392-870F-20AAE1B926B2}")) ; AutoHotkey.dll v1.1 Default
MsgBox % dll.ahktextdll("MsgBox Thread")
MsgBox End


wickss
  • Members
  • 19 posts
  • Last active: Oct 18 2008 11:56 PM
  • Joined: 08 Jun 2007
It fails on the third line.

I get:
6442450944
1

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Which dll are you using and what is your system, 32 or 64-bit?

wickss
  • Members
  • 19 posts
  • Last active: Oct 18 2008 11:56 PM
  • Joined: 08 Jun 2007
I am using x64w and I have a 64 bit system.