How to get AutoIt reference working in C#?

2

I'm pulling my hair out on this one...

I have a legacy application I built a few years ago that uses AutoItX - all working fine.

The time has come to try and update the app, so I've upgraded it to VS2012/.NET4 and I simply cannot get a reference to the AutoItX library to work.

I have installed the application, have registered the dll with regsvr32, tried every combination of property settings on the reference itself (Embed Interop Types / Isolated), but no joy.

The error I keep getting whenever I try and create an AutoItX3 object is:

Retrieving the COM class factory for component with CLSID {1A671297-FA74-4422-80FA-6C5D8CE4DE04} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Is it an issue that I'm on a 64-bit machine? I'm not trying to use the 64-bit DLL version.

c#
com
autoit-c#-wrapper
asked on Stack Overflow Feb 1, 2013 by Chris Haines • edited Mar 6, 2020 by user4157124

2 Answers

6

Okay the solution was:

  1. Open up regedit*32 (c:\windows\syswow64\regedit)
  2. Search for AutoItX in HKEY_CLASSES_ROOT\AppID
  3. I found it in HKEY_CLASSES_ROOT\AppID{6E8109C4-F369-415D-AF9A-2AEEFF313234}
  4. Create a blank REG_SZ (String) entry called DllSurrogate

For some reason, this completely solved the issue.

Reference: How to use a 32 bit COM object on Windows Server 2008 (works on 2008 R2 but non 2008)

answered on Stack Overflow Feb 1, 2013 by Chris Haines • edited May 23, 2017 by Community
2

Hainesy,

do you use a x64-Windows? I had the same problem when I was starting to have a look at COM. If so, you should try to register your class in HKEY_LOCAL_MACHINE\SOFTWARE\WoW6432Node\Classes...

Give it a try!

Greeting

answered on Stack Overflow Feb 1, 2013 by bash.d

User contributions licensed under CC BY-SA 3.0