C#來電顯示管理器開發(fā)示例程序 |
chen在2010/2/22發(fā)表,被瀏覽6314次
|
源程序JDTest.rar(點擊下載) 控件包JDComPort.rar(點擊下載 ),詳情請看:來電管理設備的ActiveX控件(OCX)開發(fā)文檔 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"; } } }
|
|
|
|