且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在不注册的情况下在 .NET (C#) 中使用 AutoItX

更新时间:2023-08-23 11:59:10

在 Visual Studio 的 C# 项目中,只需转到 Reference -> Add Reference -> 浏览到 AutoIt dll 即可.不需要单独注册.但使用此方法您必须注册.

In your C# project from Visual Studio, just go to Reference -> Add Reference -> Browse to your AutoIt dll and you're done. There's no need to register it seperately. But using this method you have to register.

更好的方法是直接使用 DLL,使用 [DllImport] 语句.这是您可以使用的示例类:http://www.autoitscript.com/forum/topic/72905-c-use-of-the-dll-some-idears-for-you/

A better way is to use the DLL directly, with [DllImport] statements. Here is a sample class that you can use: http://www.autoitscript.com/forum/topic/72905-c-use-of-the-dll-some-idears-for-you/

它定义了这样的函数:

[DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
static public extern int AU3_MouseUp([MarshalAs(UnmanagedType.LPStr)] string Button);