基本信息
源码名称:C#短信猫二次开发(收短信/发短信)示例源码
源码大小:0.21M
文件格式:.rar
开发语言:C#
更新时间:2018-01-13
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO.Ports;

namespace SmsServer
{
    public partial class Form1 : Form
    {
        [DllImport("GSM.dll")]
        public static extern int LinkModem(int iPort);
        [DllImport("GSM.dll")]
        public static extern int CloseModem();
        [DllImport("GSM.dll")]
        public static extern int CheckModem();

        [DllImport("GSM.dll")]
        public static extern string GetService();
        [DllImport("GSM.dll")]
        public static extern int SendSMS(String smsCenter, String phone, String msg);

        [DllImport("GSM.dll")]
        public static extern int NewMessageToWhere(int iSaveType);

        [DllImport("GSM.dll")]
        public static extern string GetNewMessage();

        [DllImport("GSM.dll")]
        public static extern string GetMessage(int Index);

        [DllImport("GSM.dll")]
        public static extern int DeleteSMSByNo(int Index);
        [DllImport("GSM.dll")]
        public static extern int DeleteAllSMS();

        [DllImport("GSM.dll")]
        public static extern string myTest();
        public Form1()
        {
            InitializeComponent();
        }

        private void 连接设备ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.comboBox1.Text.Trim() != "")
            {
            if (LinkModem(int.Parse(comboBox1.Text.Trim().Substring(3,1))) > 0)
                MessageBox.Show("连接设备成功!");
            else
                MessageBox.Show("连接设备失败!");
            }
            else
                MessageBox.Show("请先选择串口号!");
        }

        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            panel2.Visible = true;
            panel2.Dock = DockStyle.Fill;
            foreach (string vPortName in SerialPort.GetPortNames())
            {
                this.comboBox1.Items.Add(vPortName);
            }

        }

        private void 发送短信ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string Service = GetService();
            MessageBox.Show(Service);
        }
    }
}