Search code examples
c#comautoit-c#-wrapper

How to get AutoIt reference working in C#?


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.


Solution

  • 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)