C# application using AutoIt.dll issue


I am using AutoIt dll in my C# application to get data from active windows of other program. On my computer, where I compile this application, it works OK, but when I tried to run it on other computer I got exception:

System.Runtime.InteropServices.COMException (0x80040154): Pobranie fabryki klasy COM dla składnika o identyfikatorze CLSID {1A671297-FA74-4422-80FA-6C5D8CE4DE04} nie powiodło się z powodu następującego błędu: 80040154 Klasa niezarejestrowana. (Wyjątek od HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

w System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
w System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
w System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) w System.Activator.CreateInstance(Type type, Boolean nonPublic) w System.Activator.CreateInstance(Type type) w GetFromGam.GetFromGamForm.receiveData() w GetFromGam.GetFromGamForm.receiveButton_Click(Object sender, EventArgs e) w System.Windows.Forms.Control.OnClick(EventArgs e) w System.Windows.Forms.Button.OnClick(EventArgs e) w System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) w System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) w System.Windows.Forms.Control.WndProc(Message& m) w System.Windows.Forms.ButtonBase.WndProc(Message& m) w System.Windows.Forms.Button.WndProc(Message& m) w System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) w System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) w System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

What could be wrong in this situation?

asked on Stack Overflow Dec 28, 2016 by fafal • edited Mar 6, 2020 by user4157124

2 Answers


The computer you're trying to run your code on hasn't had the AutoIt COM interface registered. The following is from the AutoItX documentation:

Using the COM Interface Before you can use the COM interface to AutoItX it needs to be "registered" (This is done automatically when you install the full version of AutoIt but you may need to do it manually if you are using AutoItX separately).

To register the COM interface:

  1. Open a command prompt

  2. Change directory (using CD) to the directory that contains AutoItX3.dll

  3. Type regsvr32.exe AutoItX3.dll and press enter

The name of the AutoItX control is AutoItX3.Control

answered on Stack Overflow Dec 28, 2016 by Richard

Adding to the correct answer - Visual Studio has an out-of-the-box project template to create an installer for your application. That will allow you to include the dll in an installation routine. As a result sharing the software becomes a pleasant experience to the recipient.

answered on Stack Overflow Jan 20, 2017 by ashemha • edited May 23, 2018 by Alexander Christov

User contributions licensed under CC BY-SA 3.0