gsm.cs
来自「企业短信群发系统」· CS 代码 · 共 66 行
CS
66 行
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace SMS.BaseClass
{
class GSM
{
[DllImport("dllforvc.dll", //初始化GSM MODEM,并连接GSM MODEM
EntryPoint = "GSMModemInitNew",
CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.StdCall)]
public static extern bool GSMModemInitNew(
string device,
string baudrate,
string initstring,
string charset,
bool swHandshake,
string sn);
[DllImport("dllforvc.dll", //获取短信猫新的表示号码
EntryPoint = "GSMModemGetSnInfoNew",
CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.StdCall)]
public static extern string GSMModemGetSnInfoNew(string device, string baudrate);
[DllImport("dllforvc.dll", //获取当前通信端口
EntryPoint = "GSMModemGetDevice",
CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.StdCall)]
public static extern string GSMModemGetDevice();
[DllImport("dllforvc.dll", //获得当前通信波特率
EntryPoint = "GSMModemGetBaudrate",
CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.StdCall)]
public static extern string GSMModemGetBaudrate();
[DllImport("dllforvc.dll", //断开连接并释放内存空间
EntryPoint = "GSMModemRelease",
CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.StdCall)]
public static extern void GSMModemRelease();
[DllImport("dllforvc.dll", //获取错误信息
EntryPoint = "GSMModemGetErrorMsg",
CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.StdCall)]
public static extern string GSMModemGetErrorMsg();
[DllImport("dllforvc.dll", //发送短信息
EntryPoint = "GSMModemSMSsend",
CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.StdCall)]
public static extern bool GSMModemSMSsend(
string serviceCenterAddress,
int encodeval,
string text,
int textlen,
string phonenumber,
bool requestStatusReport);
//接收短信息返回字符串格式为:手机号码|短信内容||手机号码|短信内容||
[DllImport("dllforvc.dll",
EntryPoint = "GSMModemSMSReadAll",
CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.StdCall)]
//RD_opt为1接收短信息后不做任何处理,0为接收后删除信息
public static extern string GSMModemSMSReadAll(int RD_opt);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?