【实例简介】
【实例截图】
【核心代码】
///摘要
///程式使用C#.NET 2005 编写
///引用类库OPCDAAuto.dll
///OPCServer采用KEPWare
///在windows xp sp2、sp3、windows 2003上测试通过
///完成于:2008年12月31日
///测试于:2009年01月05日
///
///作者:潇洒草
///Email:zhkai868@163.com
///QQ:44649029
///
///如分发,请保留此摘要。
///鄙视那些拿代码当宝贝的人,鄙视那些拿源码换源码的人,鄙视那些自私的人。
///别人看到你的代码,你能死啊?对你有多大威胁啊?强烈鄙视~~~
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Collections;
using OPCAutomation;
namespace OPC测试通过
{
public partial class MainFrom : Form
{
public MainFrom()
{
InitializeComponent();
}
#region 私有变量
///
/// OPCServer Object
///
OPCServer KepServer;
///
/// OPCGroups Object
///
OPCGroups KepGroups;
///
/// OPCGroup Object
///
OPCGroup KepGroup;
///
/// OPCItems Object
///
OPCItems KepItems;
///
/// OPCItem Object
///
OPCItem KepItem;
///
/// 主机IP
///
string strHostIP = "";
///
/// 主机名称
///
string strHostName = "";
///
/// 连接状态
///
bool opc_connected = false;
///
/// 客户端句柄
///
int itmHandleClient = 0;
///
/// 服务端句柄
///
int itmHandleServer = 0;
#endregion
#region 方法
///
/// 枚举本地OPC服务器
///
private void GetLocalServer()
{