C#来电显示管理器开发示例程序 |
chen在2010/2/22发表,被浏览6314次
|
源程序JDTest.rar(点击下载) 控件包JDComPort.rar(点击下载 ),详情请看:来电管理设备的ActiveX控件(OCX)开发文档 1、必须安装 JDComPort ActiveX 控件:运行REGJD.bat; 2、在VS2008中添加 JDComponent Control 组件: (1)在工具箱中按鼠标右键,选择“选择项”,如下图: (2)选择“COM 组件”、“JDComponent Control”,如下图: 3、在VS2008中新建 C# 项目,并添加“JDComponent Control”、2个“Button”、“TextBox”到项目中,如下图: 4、按如下代码输入程序:
namespace JDTest { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //设置来电管理器连接端口,第一次连接时使用 axJDComponent1.SetupPorts(); } private void button2_Click(object sender, EventArgs e) { axJDComponent1.Open(); } private void axJDComponent1_OnOpen(object sender, EventArgs e) { textBox1.Text = "JD Open\r\n"; } private void axJDComponent1_OnClose(object sender, EventArgs e) { textBox1.Text += "JD Close\r\n"; } private void axJDComponent1_OnRead(object sender, AxJDCompPort.IJDComponentEvents_OnReadEvent e) { //当有电话打入时 DateTime t = DateTime.FromOADate(e.t); textBox1.Text += e.devid + " " + e.s + " " + t.ToString("MM-dd hh:mm:ss") + "\r\n"; } private void axJDComponent1_OnKeyPress(object sender, AxJDCompPort.IJDComponentEvents_OnKeyPressEvent e) { textBox1.Text += e.devid + " " + e.key + "\r\n"; } } }
|
|
|
|