有没有谁能给一个最简单的c#下opc增加一个group和一个item的示例,找太久了! 参考http://www.168com.org/article.asp?id=38 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public bool AddGroup(string groupName, int bActive, int updateRate, out string error) { error = ""; int dwLCID = 0x407; //本地语言为英语 int pRevUpdateRate; float deadband = 0; // 处理非托管COM内存 GCHandle hDeadband; IntPtr pTimeBias = IntPtr.Zero; IntPtr pDeadband = IntPtr.Zero; hDeadband = GCHandle.Alloc(deadband, GCHandleType.Pinned); try { pIOPCServer.AddGroup(groupName, //组名 bActive, //创建时,组是否被激活 updateRate, //组的刷新频率,以ms为单位 hClientGroup, //客户号 pTimeBias, //这里不使用 //(IntPtr)hDeadband, pDeadband, dwLCID, //本地语言 out nSvrGroupID, //移去组时,用到的组ID号 out pRevUpdateRate, //返回组中的变量改变时的最短通知时间间隔 ref iidRequiredInterface, out pobjGroup1); //指向要求的接口 hClientGroup = hClientGroup + 1; int groupID = nSvrGroupID; //groupsID.Add(groupName, groupID); groups.Add(groupName, pobjGroup1); groupsID.Add(groupName, groupID); } catch (System.Exception err) //捕捉失败信息 { error = "错误信息:" + err.Message; } finally { if (hDeadband.IsAllocated) hDeadband.Free(); } if (error == "") return true; else return false; } 100份:没有委托就不能完成很多工作 C#里chart怎么用。。 c# form 没装Oracle的情况下不能添加引用? 100分的简单问题:关于Attribute能否支持事件? 请教高手一个算法C# 画图问题,请给个最优解吧~~~~ 关于console的执行问题(简单) 关于写入文本文件问题 如何用C#读出表的结构(主要是获得字段的默认值) C#开发问题 C#操作excel问题,急等! 读取文件问题
{
error = "";
int dwLCID = 0x407; //本地语言为英语
int pRevUpdateRate;
float deadband = 0;
// 处理非托管COM内存
GCHandle hDeadband;
IntPtr pTimeBias = IntPtr.Zero;
IntPtr pDeadband = IntPtr.Zero;
hDeadband = GCHandle.Alloc(deadband, GCHandleType.Pinned);
try
{
pIOPCServer.AddGroup(groupName, //组名
bActive, //创建时,组是否被激活
updateRate, //组的刷新频率,以ms为单位
hClientGroup, //客户号
pTimeBias, //这里不使用
//(IntPtr)hDeadband,
pDeadband,
dwLCID, //本地语言
out nSvrGroupID, //移去组时,用到的组ID号
out pRevUpdateRate, //返回组中的变量改变时的最短通知时间间隔
ref iidRequiredInterface,
out pobjGroup1); //指向要求的接口
hClientGroup = hClientGroup + 1;
int groupID = nSvrGroupID;
//groupsID.Add(groupName, groupID);
groups.Add(groupName, pobjGroup1);
groupsID.Add(groupName, groupID);
}
catch (System.Exception err) //捕捉失败信息
{
error = "错误信息:" + err.Message;
}
finally
{
if (hDeadband.IsAllocated) hDeadband.Free();
}
if (error == "")
return true;
else
return false;
}