我已经安装了 Okuma THINC_API。要在我的程序中使用它,我知道我需要将
Dim objMachine As Okuma.CMDATAPI.DataAPI.CMachine
放在某个地方。它是否与“using”指令一起出现在顶部?或者它需要在我的命名空间内吗?
简短的回答:在你的命名空间中
帮助文件中的“入门”部分应该有一个示例。 我从(C# 中)开始的模板是:
using Okuma.CMDATAPI;
using Okuma.CMCMDAPI;
namespace BasicAPIReferenceApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Okuma.CMDATAPI.DataAPI.CMachine objMachine;
Okuma.CMDATAPI.DataAPI.CVariables objVariables;
// Create an instance of CMachine class
objMachine = new Okuma.CMDATAPI.DataAPI.CMachine();
//Call the Init method of CMachine class to initialize the library once for the entire application.
objMachine.Init();
MessageBox.Show(
System.Enum.GetNames(typeof(Okuma.CMDATAPI.Enumerations.OperationModeEnum)).
GetValue((int)objMachine.GetOperationMode()).
ToString());
// Create other classes in the library for your need.
objVariables = new Okuma.CMDATAPI.DataAPI.CVariables();
// Set common variable 1 to value 10;
objVariables.SetCommonVariableValue(1, 10);
// When your application exits (finalize, onClose(), etc) you must
// release the connections to the thinc api using the following code:
objMachine.Close();
}
}
}