我收到了一个用C#编写的示例,该示例无法编译并且无法理解我所缺少的内容。
MakeConnection是解决方案参考中存在的ACTIVEDSOLib.DActiveDSO的成员。
Interop.ACTIVEDSOLib.dll已加载并列出,如png文件所示。
已在Tools \ Choose Tool Box IteCOM组件中选中参考ActiveX对象,指向实际的OCX。不知道我在想什么。
{
public dynamic scope;
static void Main()
{
Console.WriteLine("connecting to oscilloscope Lecroy");
var scope = Activator.CreateInstance(Type.GetTypeFromProgID("LeCroy.ActiveDSOCtrl"));
// Establish connection to device
Console.Write("type correct IP address of scope");
String IPstring = Console.ReadLine();
Console.WriteLine("DSO: Connecting to " + IPstring);
var connectionOk = scope.MakeConnection(IPstring);
if (!connectionOk)
{
throw new Exception("Connection failed");
}
}
}
}