使用AutoIt.dll问题的C#应用​​程序

时间:2016-12-28 19:06:43

标签: c# autoit

我在C#应用程序中使用AutoIt dll从其他程序的活动窗口获取数据。在我编译此应用程序的计算机上,它运行正常,但当我尝试在其他计算机上运行它时,我得到了异常:

  

System.Runtime.InteropServices.COMException(0x80040154):Pobranie fabryki klasy COMd​​laskładnikaoidentyfikatorze CLSID {1A671297-FA74-4422-80FA-6C5D8CE4DE04}niepopiodłosięzpododuastępującegabłędu:80040154 Klasa niezarejestrowana。 (WyjątekodHRESULT:0x80040154(REGDB_E_CLASSNOTREG))。

     

w System.RuntimeTypeHandle.CreateInstance(RuntimeType类型,Boolean publicOnly,Boolean noCheck,Boolean& canBeCached,RuntimeMethodHandleInternal& ctor,Boolean& bNeedSecurityCheck)
  w System.RuntimeType.CreateInstanceSlow(布尔值publicOnly,布尔值skipCheckThis,布尔值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(类型类型)          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(消息& m,MouseButtons按钮,Int32点击)          w System.Windows.Forms.Control.WndProc(消息& m)          w System.Windows.Forms.ButtonBase.WndProc(Message& m)          w System.Windows.Forms.Button.WndProc(消息& 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)

在这种情况下会出现什么问题?

2 个答案:

答案 0 :(得分:2)

您尝试运行代码的计算机尚未注册AutoIt COM接口。以下内容来自AutoItX文档:

  

使用COM接口在使用COM接口之前   AutoItX需要“注册”(这是自动完成的   您安装完整版AutoIt但您可能需要这样做   如果您单独使用AutoItX,请手动操作。

     

注册COM接口:

     
      
  1. 打开命令提示符

  2.   
  3. 将目录(使用CD)更改为包含AutoItX3.dll的目录

  4.   
  5. 键入regsvr32.exe AutoItX3.dll并按Enter键

  6.         

    AutoItX控件的名称是AutoItX3.Control

答案 1 :(得分:2)

添加正确的答案 - Visual Studio有一个开箱即用的项目模板,可以为您的应用程序创建安装程序。这将允许您将dll包含在安装例程中。因此,共享软件成为收件人的愉快体验。