我已经安装了Okuma THINC_API。为了在我的程序中使用它,我知道我需要把"Dim objMachine As Okuma.CMDATAPI.DataAPI.CMachine“放在某个地方。它是否会随着“using”指令一起出现在最上面?或者它是否需要在我的命名空间中?
发布于 2013-07-19 21:41:24
简而言之:在您的命名空间内
在“入门”部分的帮助文件中应该有一个示例。我开始使用的模板(在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();
}
}
}https://stackoverflow.com/questions/17734076
复制相似问题