先交待一下开发平台:Windows 2000 Advance Server操作系统、Visual Studio .Net 、Oxygen Sms ActiveX Control V2.3 (Share Ware)、 Nokia 3210手机通过数据线接在COM1上。运行Visual Studio .Net,新建一个C#的项目,选择“Windows Server”类型的项目,命名为“SmsServer”。在Server1的设计画面,将“ServerName”命名为“SmsServer”。点击“视图设计器按钮”切换到设计画面,在“Windows Forms”工具箱中拖一时钟控件,命名为“SmsTimer”,在“Components”工具箱中拖一“EventLog”控件。命名为“eventLog1”。在“项目”菜单中点击“添加引用”,选择“COM”页,浏览到安装Oxygen Sms ActiveX Control V2.3程序的目录,找到SMSControl.ocx添加到“选定的组件”中。
将Server1.cs代码替换为
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.IO;
using System.Text ;
namespace SmsServer
{
public class SmsServer : System.ServiceProcess.ServiceBase