C#autocad sendcommand怎么传递参数给调用的dll方法
下面是一个简单的示例代码,演示了如何使用SendCommand将参数传递给DLL方法。
using System.Runtime.InteropServices;
using Autodesk.AutoCAD.Runtime;
namespace SampleCommands
{
public class MyCommands
{
[DllImport("mydll.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void MyDllMethod(string myParam);
[CommandMethod("MyCommand")]
public void MyCommand()
{
string myParam = "Hello, world!";
MyDllMethod(myParam);
}
}
}