首页 新闻 会员 周边

OPC 在调用IOPCServer.AddGroup 的时候 报出错误“值不在预期范围内”

0
[已关闭问题] 关闭于 2008-01-26 01:39
-------------------------定义的OPC操作类-------------------- <BR>using &nbsp; OpcRcw.Da; <BR>using &nbsp; OpcRcw.Comn; <BR><BR>using &nbsp; System; <BR>using &nbsp; System.Collections; <BR>using &nbsp; System.Collections.Generic; <BR>using &nbsp; System.Runtime.InteropServices; <BR>using &nbsp; System.Text; <BR><BR><BR>namespace &nbsp; WCS_SWKJ <BR>{ <BR>&nbsp; &nbsp; &nbsp; &nbsp; public &nbsp; class &nbsp; ClassOpcSynchro <BR>&nbsp; &nbsp; &nbsp; &nbsp; { <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public &nbsp; string &nbsp; serverName &nbsp; = &nbsp; "OPC.SimaticNET"; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public &nbsp; IOPCServer &nbsp; pIOPCServer; &nbsp; // &nbsp; OPC &nbsp; server接口 <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public &nbsp; Object &nbsp; pobjGroup1; &nbsp; // &nbsp; Pointer &nbsp; to &nbsp; group &nbsp; object &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public &nbsp; int &nbsp; nSvrGroupID; &nbsp; // &nbsp; server &nbsp; group &nbsp; handle &nbsp; for &nbsp; the &nbsp; added &nbsp; group &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public &nbsp; System.Collections.Hashtable &nbsp; groupsID &nbsp; = &nbsp; new &nbsp; Hashtable(11); &nbsp; //用于记录组名和组ID号 <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public &nbsp; System.Collections.Hashtable &nbsp; hitemsID &nbsp; = &nbsp; new &nbsp; Hashtable(17); &nbsp; //用于记录项名和项ID号 <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public &nbsp; Guid &nbsp; iidRequiredInterface; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public &nbsp; int &nbsp; hClientGroup &nbsp; = &nbsp; 0; &nbsp; //客户组号 <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public &nbsp; int &nbsp; hClientItem &nbsp; = &nbsp; 0; &nbsp; //Item号 <BR><BR><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /// &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /// &nbsp; 创建一个OPC &nbsp; Server接口 <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /// &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /// &nbsp; 返回错误信息 <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /// &nbsp; 若为true,创建成功,否则创建失败 <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public &nbsp; bool &nbsp; Open(out &nbsp; string &nbsp; error) <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ///dt &nbsp; = &nbsp; new &nbsp; S7Connection.DataChange(DataChange); <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ///server &nbsp; = &nbsp; new &nbsp; AsynServer(S7Connection.ServerType.OPC_SimaticNET, &nbsp; dt); <BR><BR>&nbsp; &nbsp; &n
cloudgamer的主页 cloudgamer | 菜鸟二级 | 园豆:280
提问于:2008-01-19 01:19
< >
分享
所有回答(1)
0
Xw_hacker | 园豆:58 (初学一级) | 2012-11-14 19:53
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册