当前位置: 代码迷 >> 综合 >> HUAWEI SMEIDLL 短讯接口API
  详细解决方案

HUAWEI SMEIDLL 短讯接口API

热度:41   发布时间:2024-01-18 06:49:05.0
SMEIDLL提供的功能:
  
  1. 低层链路出现故障时,重连链路,提示上层。
  2. 和SMSC的定时握手。
  3. 提供实现SMPP和内部协议中定义的相关协议的API函数。
  '事件:点击主界面的“初始化”按钮
  
  '功能:初始化套接字,准备连接
  Private Sub cmdInitSocket_Click()
  Dim bRet As Boolean
  Dim ulRet As Long
  Dim iCount As Integer
  
  StatusBar1.Panels(1).Text = ""
  ulRet = IFInitInterface(CodeProtocol + 1, DriverProtocol + 1, _
   Trim(DriverParam))
  fStatusform.ProgressBar1.Value = 100
  Unload fStatusform
  If ulRet <> 0 Then
   MsgBox "初始化套接字成功!"
   StatusBar1.Panels(1).Text = "初始化连接成功"
  Else
   MsgBox "初始化失败!"
   StatusBar1.Panels(1).Text = "初始化连接失败"
  End If
  End Sub

  '事件:点击主界面的“登录服务器”按钮
  
  '功能:登录服务器
  Private Sub cmdLogin_Click()
  Dim bRet As Boolean
  Dim ulRet As Long

  StatusBar1.Panels(1).Text = ""
  ulRet = Login_R(Trim(SystemID), Trim(Password))
  If ulRet <> 0 Then
   MsgBox "登录成功!"
   StatusBar1.Panels(1).Text = "登录成功"
  Else
   MsgBox "登录失败!"
   StatusBar1.Panels(1).Text = "登录失败"
  End If
  End Sub

  '事件:点击主界面的“发送短讯”按钮
  
  '功能:向服务器提交短讯信息
  Private Sub cmdSubmit_Click()
  Dim result As Integer
  Dim UDLen As Long

  StatusBar1.Panels(1).Text = ""
  'Dim UserData As String
  UserData = "test info"
  UDLen = Len(UserData)
  result = SubmitA(OrgTON, OrgNPI, Trim(OrgAddr), DestTON, DestNPI, _
   DestAddr, PRI, RD, RP, SRR, MR, DCS * 4, PID, _
   Trim(Schedule), Trim(Expire), Default_ID, UDHI, UDLen, UserData, SM_ID, FCS)
  If result = 0 Then
   MsgBox "发送成功!"
   StatusBar1.Panels(1).Text = "发送成功"
  Else
   MsgBox "发送失败!"
   StatusBar1.Panels(1).Text = "发送失败"
  End If
  End Sub
  
  
  '事件:点击主界面的“获取消息”按钮
  
  '功能:判断是否有新短讯发来,如果有,则获取该短讯的信息
  Private Sub cmdGetMsg_Click()
  StatusBar1.Panels(1).Text = ""
  GetMsg
  End Sub
  
  '功能: 公共函数。判断是否有新短讯发来;如果有, 则获取该短讯的信息
  Sub GetMsg()
  Dim result As Integer
  HDM_TimeOut = 2000
  result = HasDeliverMessage(HDM_TimeOut)
  If result = 0 Then
   MsgBox "你有新短讯!"
   StatusBar1.Panels(1).Text = "有新短讯"
  Else
   StatusBar1.Panels(1).Text = "无新短讯"
  End If
  If result = 0 Then
   result = GetDeliverSMEx(SM_ID_R, DestTON_R, DestNPI_R, DestAddr_R, OrgTON_R, OrgNPI_R, OrgAddr_R, PRI_R, RP_R, UDHI_R, PID_R, DCS_R, TimeStamp_R, UDLen_R, UserData_R)

   If result = 0 Then
   MsgBox "接收短讯成功!"
   StatusBar1.Panels(1).Text = "接受短讯成功"
   Set fNewSMForm = New frmNewSM
   fNewSMForm.List1.AddItem "短消息的ID:" + CStr(SM_ID_R)
   fNewSMForm.List1.AddItem "目标地址号码类型:" + CStr(DestTON_R)
   fNewSMForm.List1.AddItem "目标地址编码方案:" + CStr(DestNPI_R)
   fNewSMForm.List1.AddItem "目标地址:" + DestAddr_R
   fNewSMForm.List1.AddItem "源地址号码类型:" + CStr(OrgTON_R)
   fNewSMForm.List1.AddItem "源地址编码方案:" + CStr(OrgNPI_R)
   fNewSMForm.List1.AddItem "源地址:" + OrgAddr_R
   fNewSMForm.List1.AddItem "回应路径:" + CStr(RP_R)
   fNewSMForm.List1.AddItem "头结构指示:" + CStr(UDHI_R)
   fNewSMForm.List1.AddItem "协议标志:" + CStr(PID_R)
   fNewSMForm.List1.AddItem "编码方案:" + CStr(DCS_R)
   fNewSMForm.List1.AddItem "提交时间:" + TimeStamp_R
   fNewSMForm.List1.AddItem "短消息的UDL:" + CStr(UDLen_R)
   fNewSMForm.List1.AddItem "正文:" + UserData_R
   fNewSMForm.Show
   Else
   MsgBox "接收短讯失败!"
   StatusBar1.Panels(1).Text = "接收短讯失败"
   End If
  End If
  End Sub

  
  '事件:点击主界面的“定时获取消息”按钮
  
  '功能:启动定时获取短讯的服务
  Private Sub cmdTimerGetMsg_Click()
  StatusBar1.Panels(1).Text = ""
  If Timer1.Enabled = False Then
   Timer1.Enabled = True
   StatusBar1.Panels(1).Text = "启动定时获取短讯服务"
  Else
   Timer1.Enabled = False
   StatusBar1.Panels(1).Text = "关闭定时获取短讯服务"
  End If
  End Sub
  
  '事件:点击主界面的“退出系统”按钮
  
  '功能:退出安装短讯中心的服务器
  Private Sub cmdLogout_Click()
  Call IFExitInterface
  Call Logout
  Unload fMainForm
  End Sub
  模块文件代码:
  'Option Explicit
  '
  '/*******************************************************************************
  'FileName: Export.h
  'Description: 本头文件定义了SMEIDLL提供的所有输出函数的定义?
  'Version : 2.0
  'Date : 98/11/01
  'Others:
  'Function List():
  ' 01. IFInitInterface :初始化动态库
  ' 02. IFSendAndAnswer :基本的发送等待回包函数
  ' 03. IFSetOnRead :设置读回调函数,用于处理非回包数据
  ' 04. IFSetOnError :设置出错回调函数,用于通知上层
  ' 05. IFExitInterface :退出动态库函数
  ' 06. Login :登录函数,使用TRANSMITER命令
  ' 07. Logout :从短讯中心注销
  ' 08. SubmitSM :提交短讯
  ' 09. VPSubmitSM :提交短讯,简化函数
  ' 10. QuerySMStatus :查询短讯状态
  ' 11. QuerySMDetail :查询短讯详细属性,可查询短讯内容
  ' 12. QuerySMS :查询满足条件的短讯
  ' 13. CancelSM :取消短讯
  ' 14. ReplaceSM :替换短讯
  ' 15. AddSubscriber :添加用户
  ' 16. DeleteSubscriber :删除用户
  ' 17. ModifySubscriber :修改用户属性
  ' 18. EnquireSubscriber :查询用户属性
  ' 19. HasDeliverMessage :查询是否有下发短讯
  ' 20. GetDeliverSM :取下发短讯
  ' 21. Login_R :登录函数,使用RECEIVER命令
  ' 22. VPModifySubPassword :修改用户密码
  ' 23. GetErrorString :查询错误代码的描述
  ' 24. SubmitA :增强的SUBMIT函数
  ' 25. VPSubmitA :增强的SUBMIT函数的VP版
  ' 26. GSMConvertTextToData :把ASC字符串变换成指定编码
  ' 27. GSMConvertDataToText :把编码数据变换成ASC字符串
  ' 28. QuerySub
  'History:
  ' 1. author : 张刚
  ' time : 98/11/01
  ' release : 2.0
  'desc: 实现基本功能
  '
  ' 2. author : 张刚
  ' time : 99/06/01
  ' release : 2.1
  ' desc : 优化,修改了一些错误,添加了新函数。
  '
  '*******************************************************************************/
  '
  '#if !defined(__SEMIDLL_EXPORT_H__)
  '#define __SEMIDLL_EXPORT_H__
  '
  '#include "Funback.h"
  '#include "Drv.h"
  '
  '#define IF_TIMEOUT 5000 //发送超时时间
  '
  '//最大的短消息文本长度为255*140=35700
  '#define MAX_SMSIZE 35700 //最大短讯长度
  '
  '#define ACK_SUCCESS 0 //ACK执行正确
  '
  '#define SM_PRI_PRIOR 1 //优先级别
  '#define SM_PRI_DEFAULT 0 //缺省
  '
  '#define SM_DCS_DEFAULT 0x00 //缺省(7位)
  '#define SM_DCS_ASC 0x04 //英文(不被手机支持)
  '#define SM_DCS_CHINA 0x08 //中文(会被转化成UCS2)
  '
  '#define SM_UDHI_DEFAULT 0 //UD是正常字符串
  '#define SM_UDHI_STRUCTURE 1 //UD是结构
  '
  '#define CHINA_ERRSTR 0X40000000 //返回汉字的错误字符串
  '
  '#define SMSCERR_BEGIN 10000
  '
  '
  'Enum DLL_RETURN
  '{
  ' E_SUCCESS = 0, //成功
  '
  ' //IFSendAndAnswer函数的返回值
  ' E_NOT_INITIALIZED, //INTERFACE没有初始化
  ' E_ACK_COMMAND_ERROR, //回包命令字错误
  ' E_NEWMEMORY_ERROR, //分配内存错误
  ' E_OTHER_ERROR, //其他错误
  '
  ' E_SA_BUFF_TOOBIG, //SEND缓冲区太大
  ' E_SA_POCKET_UNINTEGRATE, //SEND包不完整
  ' E_SA_PROTOCOL_ERROR, //协议错
  ' E_SA_PROTOCOL_NO_SUPPORT, //协议不支持该格式
  ' E_SA_CODE_OTHER_ERROR, //编码其他错误
  ' E_SA_TIMEOUT, //传送超时
  ' E_SA_NO_ENOUGH_BUFFER, //接收缓冲区不够大
  ' E_SA_WAITFAILED, //等待失败
  ' E_SA_SEND_FAILED, //发送失败
  '
  ' //SUBMIT函数的返回值
  ' E_SUBMIT_ORGADDR_ERROR, //源地址错误
  ' E_SUBMIT_DESTADDR_ERROR, //目的地址错误
  ' E_SUBMIT_SCHEDULE_ERROR, //参数定时时间错误
  ' E_SUBMIT_EXPIRE_ERROR, //参数超时时间错误
  ' E_SUBMIT_DCS_ERROR, //参数DCS错误
  ' E_SUBMIT_DCS_CONVERT_ERROR, //数据变换错误
  ' E_SUBMIT_UDHI_ERROR, //参数UDHI错误
  ' E_SUBMIT_UD_ERROR, //用户数据错误
  ' E_SUBMIT_OVER_MO, //超过最大提交数
  ' E_SUBMIT_OVER_MT, //超过最大下发数
  ' E_SUBMIT_INVALID_USER, //无效用户,或者用户无权
  ' E_SUBMIT_INVALID_DATA_FORMAT, //无效数据格式
  ' E_SUBMIT_ADDR_ERROR, //地址错误
  ' E_SUBMIT_CREATE_MESSAGE_ERROR, //生成短讯错误
  '
  ' //QuerySMStatus函数返回值
  ' E_QUERYSMSTATUS_SM_NOT_EXIST, //短讯不存在
  ' E_QUERYSMSTATUS_SM_OTHER_ERR, //查询其他错误
  ' E_QUERYSMSTATUS_ADDR_ERROR, //地址错误
  '
  ' //QuerySMDetail函数返回值
  ' E_QUERYSMDETAIL_SM_DETAILS_ZERO, //查询不到此
  ' E_QUERYSMDETAIL_SM_DETAILS_FAIL, //查询失败
  ' E_QUERYSMDETAIL_CONVERT_ERROR, //用户数据编码出错
  ' E_QUERYSMDETAIL_LEN_ERROR, //LEN参数出错
  ' E_QUERYSMDETAIL_SM_ADDR_ERROR, //地址错误
  '
  ' //CancelSM函数返回值
  ' E_CANCELSM_ACK_STATUS_ERROR, //回包的STATUS指示出错
  '
  ' //ReplaceSM函数返回值
  ' E_REPLACESM_ORGADDR_ERROR, //源地址错误
  ' E_REPLACESM_SCHEDULE_ERROR, //定时数据错误
  ' E_REPLACESM_EXPIRE_ERROR, //超时数据错误
  ' E_REPLACESM_DCS_ERROR, //DCS错误
  ' E_REPLACESM_DCS_CONVERT_ERROR, //用户数据编码出错
  ' E_REPLACESM_UD_ERROR, //用户数据错误
  ' E_REPLACESM_SM_WORKING, //短讯正在下发
  ' E_REPLACESM_SM_ADDR_ERROR, //短讯地址错误
  ' E_REPLACESM_SM_INVALID_SOURCE_ADDR, //无效的源地址
  ' E_REPLACESM_SM_NO_SUCH_SM, //没有指定的短讯
  ' E_REPLACESM_SM_INVALID_DATA_TYPE, //无效数据类型
  ' E_REPLACESM_SM_FAIL, //替换失败
  '
  ' E_QUERYSMS_DIR_ERROR, //参数DIR错
  ' E_QUERYSMS_ADDR_ERROR, //参数用户地址错误
  ' E_QUERYSMS_DATETIME_ERROR, //参数开始时间错误
  ' E_QUERYSMS_FINATIME_ERROR, //参数结束时间错误
  ' E_QUERYSMS_NUMBER_ERROR, //参数查询条数错误
  ' E_QUERYSMS_ACK_STATUS_ERROR, //回包的STATUS指示出错
  '
  ' E_ADDSUB_SUBID_ERROR, //参数用户号码错误
  ' E_ADDSUB_SUBNAME_ERROR, //参数用户姓名错误
  ' E_ADDSUB_SUBADDRESS_ERROR, //参数用户地址错误
  ' E_ADDSUB_PASSWORD_ERROR, //参数用户密码错误
  ' E_ADDSUB_USER_ALREADY_EXIST, //用户已经存在
  ' E_ADDSUB_ADD_USER_FAIL, //添加用户失败
  '
  ' E_DELETESUB_SUBID_ERROR, //参数用户号码错误
  ' E_DELETESUB_USER_NOT_EXIST, //用户不存在
  ' E_DELETESUB_USER_DEL_FAIL, //删除用户失败
  '
  ' E_MODIFYSUB_SUBID_ERROR, //参数用户号码错误
  ' E_MODIFUSUB_SUBNAME_ERROR, //参数用户姓名错误
  ' E_MODIFYSUB_SUBADDRESS_ERROR, //参数用户地址错误
  ' E_MODIFYSUB_PASSWORD_ERROR, //参数用户密码错误
  ' E_MODIFYSUB_FAIL, //修改用户失败
  ' E_MODIFYSUB_SUB_NOT_EXIST, //用户不存在
  '
  ' E_ENQUIRESUB_SUBID_ERROR, //参数用户号码错误
  ' E_ENQUIRESUB_USER_NOT_EXIST, //用户不存在
  '
  ' E_ENQUIRELINK_ERROR, //握手失败
  '
  ' E_DLVSM_GETDATA_FAILED, //GETDATA失败
  ' E_DLVSM_DCS_ERROR, //解码出错
  '
  ' E_NO_RIGHT, //没有权限
  '
  ' E_REPLACE_UDHI_ERROR, //REPLACE UDHI invalid
  '
  ' E_QUERYSMDETAIL_INVLDLEN, // QUERYSMDETAIL LEN INVALID
  '
  ' E_PPSCHECKTIMEOUT = 200, //PPS用户鉴权超时
  ' E_PPSUSERCHECKERR, //PPS用户鉴权失败
  ' E_PPSUSERCHECKSENDERR, //PPS用户鉴权发送失败
  ' E_PPSRESULTNOTIFYTIMEOUT, //通知超时
  ' E_PPSRESULTNOTIFYACKERR, //通知客户端返回错误
  ' E_PPSRESULTNOTIFYTMPERR, //通知临时错误
  ' E_PPSRESULTNOTIFYSERIOUSERR, //通知严重错误
  '
  '
  '};
  '/*
  'Enum ROUTE_RETURN
  '{
  ' E_SUCCESS = 0,
  '
  ' //interfacemanager error code
  ' E_ACCESSERR, //接入码错误
  ' E_CALLERERR, //主叫错误 *
  ' E_ACCOUNTERR, //帐号指针不符 *
  ' E_SMTYPEERR, //SmType错误 *
  ' E_NEWACCOUNTFAIL, //生成帐号对象失败 *
  ' E_ACCOUNTNAMEERR, //帐号名错,查无此帐号 *
  ' E_CODETYPEERR, //编码类型错
  ' E_CREATEIFFAIL, //生成IF对象失败
  ' E_BEYONDMAXIFNUM, //超过INTERFACEMANAGER的最大IF数
  ' E_INVALIDIFID, //无效的IF的ID
  ' E_ACCOUNTPASSWORDERR, //帐号的密码错误
  ' E_NORIGHT, //没有权限
  ' E_PIDERR, //PID错误
  ' E_INVALIDROUTETABLE, //无效的ROUTETABLE *
  '
  ' E_CANNOTFINDIF, //通过HDRV不能找到IF *
  ' E_PARAMERR, //参数错
  ' E_STATUSERR, //状态错误
  '
  ' E_NEWIFERR, //生成IF错误
  ' E_NEWDRVERR, //生成DRV错误
  '
  ' //routetable
  ' E_INVALIDACCOUNT, //无效的ACCOUNT *
  '
  ' //account error code
  ' //E_BEYONDACCOUNTMAXIFNUM,
  ' E_INVALIDIF,
  ' //E_ROUTEERR,
  '
  ' E_NOSUBMITRIGHT,
  ' E_NODELIVERRIGHT,
  ' E_CHECKTYPEERR, //鉴权类型错误
  ' E_NUMREPEAT, //号段重复
  ' E_NOTHISNUM, //没有指定的号段
  '
  ' E_PPSCHECKTIMEOUT = 200, //PPS用户鉴权超时
  ' E_PPSUSERCHECKERR, //PPS用户鉴权失败
  ' E_PPSUSERCHECKSENDERR, //PPS用户鉴权发送失败
  ' E_PPSRESULTNOTIFYTIMEOUT, //通知超时
  ' E_PPSRESULTNOTIFYACKERR, //通知客户端返回错误
  ' E_PPSRESULTNOTIFYTMPERR, //通知临时错误
  ' E_PPSRESULTNOTIFYSERIOUSERR, //通知严重错误
  '
  '};
  '*/
  '
  'BOOL WINAPI IFInitInterface(
  ' DWORD dwCodeProtocol, //编码协议
  ' DWORD dwDriverProtocol, //通讯协议
  ' LPCTSTR pDriverParam //通讯参数
  ' );
  '
  Public Declare Function IFInitinterface Lib "smeidll.dll" (ByVal dwCodeProtocol As Long, _
   ByVal dwDriverPorotocol As Long, _
   ByVal pDriverParam As String) As Long
  'int WINAPI IFSendAndAnswer(
  ' LPVOID pSndBuf, //发送缓冲区
  ' int SndSize, //发送缓冲区大小
  ' LPVOID pRevBuf, //接收缓冲区
  ' int* RevSize, //接收缓冲区大小
  ' DWORD timeout //超时时间
  ' );
  '
  Public Declare Function IFSendAndAnswer Lib "smeidll.dll" (pSndBuf As Any, _
   ByVal SndSize As Long, _
   pRevBuf As Any, _
   ByVal RevSize As Long, _
   ByVal timeout As Long) As Long
  'BOOL WINAPI IFSetOnRead(
  ' LP_READ_BACK pReadFun, //回调函数指针
  ' HANDLE hReadUser //回调句柄
  ' );
  '
  Public Declare Function IFSetOnRead Lib "smeidll.dll" (pReadFun As Any, _
   ByVal hReadUser As Long) As Long
  'BOOL WINAPI IFSetOnError(
  ' LP_ERROR_BACK pErrorFun, //回调函数指针
  ' HANDLE hErrorUser //回调句柄
  ' );
  '
  Public Declare Function IFSetOnError Lib "smeidll.dll" (pErrorFun As Any, _
   ByVal hErrorUser As Long) As Long
  'BOOL WINAPI IFExitInterface();
  Public Declare Function IFExitInterface Lib "smeidll.dll" () As Long
  '
  'BOOL WINAPI LoginA(
  ' unsigned long ulBindType, //BIND类型, 0表示BIND_TRANSMITER, 1表示BIND_RECIEVER
  ' LPCTSTR SystemID, //用户标识 char [MAX_SMEI_SYSTEMID]
  ' LPCTSTR Password, //密码 char[MAX_SMEI_PASSWORD]
  ' LPCTSTR system_type, //系统类型 char[13]
  ' unsigned long ulInterface_version, //接口类型
  ' unsigned char ucAddr_TON, //号码类型
  ' unsigned char ucAddr_NPI, //编码方案
  ' LPCTSTR Address_range //地址类型
  ' );
  '
  Public Declare Function LoginA Lib "smeidll.dll" (ByVal ulBindType As Long, _
   ByVal SystemID As String, _
   ByVal Password As String, _
   ByVal system_type As String, _
   ByVal ulInterface_version As Long, _
   ByVal ucAddr_TON As Byte, _
   ByVal ucAddr_NPI As Byte, _
   ByVal Address_range As String) As Long
  
  'BOOL WINAPI Login(
  ' LPCTSTR SystemID, //用户标识 char [MAX_SMEI_SYSTEMID]
  ' LPCTSTR Password //密码 char[MAX_SMEI_PASSWORD]
  ' );
  '
  Public Declare Function Login Lib "smeidll.dll" (ByVal SystemID As String, _
   ByVal Password As String) As Long
  'BOOL WINAPI Login_R(LPCTSTR SystemID, //用户标识 char [MAX_SMEI_SYSTEMID]
  ' LPCTSTR Password //密码 char[MAX_SMEI_PASSWORD]
  ' );
  '
  Public Declare Function Login_R Lib "smeidll.dll" (ByVal SystemID As String, _
   ByVal Password As String) As Long
  'BOOL WINAPI Logout();
  Public Declare Function Logout Lib "smeidll.dll" () As Long
  '
  'int WINAPI SubmitSM(
  ' unsigned char OrgTON, //源地址号码类型
  ' unsigned char OrgNPI, //源地址编码方案
  ' LPCTSTR OrgAddr, //源地址 char[MAX_ADDR_LEN]
  ' unsigned char DestTON, //目标地址号码类型
  ' unsigned char DestNPI, //目标地址编码方案
  ' LPCTSTR DestAddr, //目标地址 char[MAX_ADDR_LEN]
  ' unsigned char PRI, //SM优先级
  ' unsigned char DCS, //数据编码方案
  ' LPCTSTR Schedule, //定时 char[MAX_TIMESTAMP_LEN]
  ' LPCTSTR Expire, //超时时间 char[MAX_TIMESTAMP_LEN]
  ' unsigned long Default_ID, //缺省短消息
  ' unsigned char UDHI, //1表示UD为一个结构,0表示缺省
  ' unsigned long UDLen, //表示UD的长度
  ' LPCTSTR UserData, //用户信息,短消息正文
  ' unsigned long* SM_ID, //返回:短消息ID
  ' unsigned char* FCS //返回:失败原因
  ' );
  '
  Public Declare Function SubmitSM Lib "smeidll.dll" (ByVal OrgTON As Byte, _
   ByVal OrgNPI As Byte, _
   ByVal OrgAddr As String, _
   ByVal DestTON As Byte, _
   ByVal DestNPI As Byte, _
   ByVal DestAddr As String, _
   ByVal PRI As Byte, _
   ByVal DCS As Byte, _
   ByVal Schedule As String, _
   ByVal Expire As String, _
   ByVal Default_ID As Long, _
   ByVal UDHI As Byte, _
   ByVal UDLen As Long, _
   ByVal UserData As String, _
   ByVal sm_id As Long, _
   ByVal FCS As String) As Long
  
  'int WINAPI VPSubmitSM(
  ' LPCTSTR OrgAddr, //源地址 char[MAX_ADDR_LEN]
  ' LPCTSTR DestAddr, //目标地址 char[MAX_ADDR_LEN]
  ' LPCTSTR Schedule, //定时 char[MAX_TIMESTAMP_LEN]
  ' LPCTSTR Expire, //超时时间 char[MAX_TIMESTAMP_LEN]
  ' unsigned long Default_ID, //缺省短消息
  ' LPCTSTR UserData, //用户信息,短消息正文
  ' unsigned long* SM_ID //返回:短消息ID
  ' );
  '
  Public Declare Function VPSubmigSM Lib "smeidll.dll" (ByVal OrgAddr As String, _
   ByVal DestAddr As String, _
   ByVal Schedule As String, _
   ByVal Expire As String, _
   ByVal Default_ID As Long, _
   ByVal UserData As String, _
   ByVal sm_id As Long) As Long
  
  'int WINAPI QuerySMStatus(
  ' unsigned long SM_ID, //短消息ID
  ' unsigned char* OrgTON, //返回:源地址号码类型
  ' unsigned char* OrgNPI, //返回:源地址编码方案
  ' LPTSTR OrgAddr, //返回:源地址 char[MAX_ADDR_LEN]
  ' unsigned char* DestTON, //返回:目标地址号码类型
  ' unsigned char* DestNPI, //返回:目标地址编码方案
  ' LPTSTR DestAddr, //返回:目标地址 char[MAX_ADDR_LEN]
  ' LPTSTR Final_Date, //返回:最后时间 char[MAX_TIMESTAMP_LEN]
  ' unsigned char* SM_Status, //返回:短消息状态
  ' //0 : WAITING_FOR_DELIVER 表示等待发送
  ' //1 : DELIVER_SUCCESS 表示成功发送
  ' //2 : DELIVER_FAIL 表示发送失败
  ' unsigned char* Error_Code //返回:错误代码
  ' );
  Public Declare Function QuerySMStatus Lib "smeidll.dll" (ByVal sm_id As Long, _
   ByVal OrgTON As String, _
   ByVal OrgNPI As String, _
   ByVal OrgAddr As String, _
   ByVal DestTON As String, _
   ByVal DestNPI As String, _
   ByVal DestAddr As String, _
   ByVal Final_Date As String, _
   ByVal SM_Status As Byte, _
   ByVal Error_Code As String) As Long
  
  
  '
  'int WINAPI QuerySMDetail(
  ' unsigned long SM_ID, //短消息ID
  ' unsigned char *OrgTON, //返回:源地址号码类型
  ' unsigned char *OrgNPI, //返回:源地址编码方案
  ' LPTSTR OrgAddr, //返回:源地址 char[MAX_ADDR_LEN]
  ' unsigned char* DestTON, //返回:目标地址号码类型
  ' unsigned char* DestNPI, //返回:目标地址编码方案
  ' LPTSTR DestAddr, //返回:目标地址 char[MAX_ADDR_LEN]
  ' unsigned char* PRI, //返回:SM优先级
  ' unsigned char* DCS, //返回:数据编码方案
  ' LPTSTR Schedule, //返回:定时 char[MAX_TIMESTAMP_LEN]
  ' LPTSTR Expire, //返回:超时时间 char[MAX_TIMESTAMP_LEN]
  ' LPTSTR Final, //返回:最后时间 char[MAX_TIMESTAMP_LEN]
  ' unsigned char* SM_Status, //返回:短消息状态, 返回值定义同QuerySMStatus.
  ' unsigned char* Error_Code, //返回:错误代码
  ' unsigned long Len, //接收短消息长度,User_Data的大小不能小于此数
  ' LPTSTR User_Data //返回:短消息文本
  ' );
  Public Declare Function QuerySMDetail Lib "smeidll.dll" (ByVal sm_id As Long, _
   ByVal OrgTON As String, _
   ByVal OrgNPI As String, _
   ByVal OrgAddr As String, _
   ByVal DestTON As String, _
   ByVal DestNPI As String, _
   ByVal DestAddr As String, _
   ByVal PRI As Byte, _
   ByVal DCS As Byte, _
   ByVal Schedule As String, _
   ByVal Expire As String, _
   ByVal Final As String, _
   ByVal SM_Status As String, _
   ByVal Error_Code As String, _
   ByVal Leng As Long, _
   ByVal User_Data As String) As Long
  '
  'int WINAPI CancelSM(
  ' unsigned long SM_ID //短消息ID
  ' );
  Public Declare Function CancelSM Lib "smeidll.dll" (ByVal sm_id As Long) As Long
  '
  'int WINAPI ReplaceSM(
  ' unsigned long SM_ID, //短消息ID
  ' unsigned char OrgTON, //源地址号码类型
  ' unsigned char OrgNPI, //源地址编码方案
  ' LPCTSTR OrgAddr, //源地址 char[MAX_ADDR_LEN]
  ' LPCTSTR Schedule, //定时 char[MAX_TIMESTAMP_LEN]
  ' LPCTSTR Expire, //超时时间 char[MAX_TIMESTAMP_LEN]
  ' unsigned char DCS, //数据编码方案
  ' unsigned long Default_ID, //缺省短消息
  ' unsigned long UDL,
  ' LPCTSTR UserData //用户信息,短消息正文
  ' );
  '
  Public Declare Function ReplaceSM Lib "smeidll.dll" (ByVal sm_id As Long, _
   ByVal OrgTON As Byte, _
   ByVal OrgNPI As Byte, _
   ByVal OrgAddr As String, _
   ByVal Schedule As String, _
   ByVal Expire As String, _
   ByVal DCS As Byte, _
   ByVal Default_ID As Long, _
   ByVal UDL As Long, _
   ByVal User_Data As String) As Long
  
  'int WINAPI QuerySMS(
  ' unsigned char Dir, //0:按源地址 1:按目标地址
  ' unsigned char TON,
  ' unsigned char NPI,
  ' LPCTSTR Addr,
  ' LPCTSTR DateTime, //开始时间
  ' LPCTSTR FinaTime, //结束时间
  ' unsigned char* Number, //要查询的条数
  ' unsigned char* status,
  ' unsigned long* sm_id
  ' );
  '
  Public Declare Function QuerySMS Lib "smeidll.dll" (ByVal Dir As Byte, _
   ByVal TON As Byte, _
   ByVal NPI As Byte, _
   ByVal Addr As String, _
   ByVal DateTime As String, _
   ByVal FinalTime As String, _
   ByVal Number As String, _
   ByVal status As String, _
   ByVal sm_id As Long) As Long
  'int WINAPI AddSubscriber(
  ' unsigned char TON, //号码类型
  ' unsigned char NPI, //编码方案
  ' LPCTSTR SubID, //用户标识 char[MAX_ADDR_LEN]
  ' LPCTSTR SubName, //用户姓名 char[MAX_ADDR_LEN]
  ' LPCTSTR SubAddress, //用户(通讯)地址 char[MAX_SUB_ADDRESS]
  ' unsigned char MsType, //手机类型
  ' unsigned long Service, //服务级别(未定义)
  ' unsigned char bSM, //是否提供短消息服务
  ' unsigned long OCOS, //最大下发数
  ' unsigned long TCOS, //最大提交数
  ' unsigned short Reserve, //保留
  ' LPCTSTR Password //密码 char [MAX_PASSWORD]
  ' );
  '
  'int WINAPI DeleteSubscriber(
  ' LPCTSTR SubID //用户标识 char[MAX_ADDR_LEN]
  ' );
  '
  'int WINAPI ModifySubscriber(
  ' unsigned char TON, //号码类型
  ' unsigned char NPI, //编码方案
  ' LPCTSTR SubID, //用户标识 char[MAX_ADDR_LEN]
  ' LPCTSTR SubName, //用户姓名 char[MAX_ADDR_LEN]
  ' LPCTSTR SubAddress, //用户地址 char[MAX_SUB_ADDRESS]
  ' unsigned char MsType, //手机类型
  ' unsigned long Service, //服务级别
  ' unsigned char bSM, //是否提供短消息服务
  ' unsigned long OCOS, //最大下发数
  ' unsigned long TCOS, //最大提交数
  ' LPCTSTR Password //密码 char [MAX_PASSWORD]
  ' );
  '
  'int WINAPI EnquireSubscriber(
  ' LPCTSTR SubID, //用户标识
  ' unsigned char* TON, //返回:号码类型
  ' unsigned char* NPI, //返回:编码方案
  ' LPTSTR SubName, //返回:用户姓名 char[MAX_ADDR_LEN]
  ' LPTSTR SubAddress, //返回:用户地址 char[MAX_SUB_ADDRESS]
  ' unsigned long* Service, //返回:服务级别
  ' unsigned char* bSM, //返回:是否提供短消息服务
  ' unsigned long* OCOS, //返回:最大下发数
  ' unsigned long* TCOS, //返回:最大提交数
  ' LPTSTR Password //返回:密码 char [MAX_PASSWORD]
  ' );
  '
  'int WINAPI EnquireLink();
  '
  'int WINAPI HasDeliverMessage(
  ' DWORD dwTimeOut //超时时间,单位毫秒
  ' );
  '
  'int WINAPI GetDeliverSM(
  ' ULONG* sm_ID, //返回:短讯ID
  ' unsigned char* DestTON, //返回:目标地址号码类型
  ' unsigned char* DestNPI, //返回:目标地址编码方案
  ' char* DestAddr, //返回:目标地址
  ' unsigned char* OrgTON, //返回:源地址号码类型
  ' unsigned char* OrgNPI, //返回:源地址编码方案
  ' char* OrgAddr, //返回:源地址
  ' unsigned char* PRI, //返回:优先权
  ' unsigned char* PID, //返回:协议类型
  ' unsigned char* DCS, //返回:编码方案
  ' char* TimeStamp, //返回:下发时间
  ' char* UserData //返回:用户数据
  ' );
  '
  'int WINAPI VPModifySubPassword(
  ' LPCTSTR SubID, //用户标识 char[MAX_ADDR_LEN]
  ' LPCTSTR Password //密码 char [MAX_PASSWORD]
  ' );
  '
  'int WINAPI GetErrorString(
  ' int iErrorNum, //错误代码
  ' int iBuffSize, //缓冲区大小
  ' char* lpszBuff //缓冲区指针
  ' );
  '
  'int WINAPI GetSMStatusString(
  ' DWORD dwStatus, // 状态值
  ' int iBuffLen, // 缓冲区大小
  ' char* lpszBuff // 缓冲区指针
  ' );
  '
  'int WINAPI SubmitA(
  ' unsigned char OrgTON, //源地址号码类型
  ' unsigned char OrgNPI, //源地址编码方案
  ' LPCTSTR OrgAddr, //源地址 char[MAX_ADDR_LEN]
  ' unsigned char DestTON, //目标地址号码类型
  ' unsigned char DestNPI, //目标地址编码方案
  ' LPCTSTR DestAddr, //目标地址 char[MAX_ADDR_LEN]
  ' unsigned char PRI, //SM优先级
  ' unsigned char RD, //当源地址和目的地址相同时,是否替换存在的短消息。
  ' unsigned char RP, //回应路径
  ' unsigned char SRR, //是否需要状态报告
  ' unsigned char MR, //消息索引
  ' unsigned char DCS, //数据编码方案
  ' unsigned char PID, //协议类型
  ' LPCTSTR Schedule, //定时 char[MAX_TIMESTAMP_LEN]
  ' LPCTSTR Expire, //超时时间 char[MAX_TIMESTAMP_LEN]
  ' unsigned long Default_ID, //缺省短消息
  ' unsigned char UDHI, //1表示UD为一个结构,0表示缺省
  ' unsigned long UDLen, //表示UD的长度
  ' LPCTSTR UserData, //用户信息,短消息正文
  ' unsigned long* SM_ID, //返回:短消息ID
  ' unsigned char* FCS //返回:失败原因
  ' );
  '
  'int WINAPI VPSubmitA(
  ' LPCTSTR OrgAddr, //源地址 char[MAX_ADDR_LEN]
  ' LPCTSTR DestAddr, //目标地址 char[MAX_ADDR_LEN]
  ' unsigned char PID, //协议类型
  ' unsigned char DCS, //编码方案
  ' LPCTSTR Schedule, //定时 char[MAX_TIMESTAMP_LEN]
  ' LPCTSTR Expire, //超时时间 char[MAX_TIMESTAMP_LEN]
  ' unsigned long Default_ID, //缺省短消息
  ' LPCTSTR UserData, //用户信息,短消息正文
  ' unsigned long* SM_ID //返回:短消息ID
  ' );
  '
  'int WINAPI GSMConvertTextToData(
  ' LPCSTR pString, //需要变换的源字符串指针
  ' unsigned char nDCS, //指定变换的编码方案
  ' unsigned char* pData, //接收缓冲区指针
  ' unsigned long* nLen //用户数据的大小的指针,此是SUBMIT中UDL字段的长度,不是字节长度
  ' );
  '
  'int WINAPI GSMConvertDataToText(
  ' unsigned char* pData, //编码后的数据
  ' unsigned long nLen, //编码数据的实际大小,此项为协议的UDL项。
  ' unsigned char nDCS, //编码数据的编码方案
  ' unsigned char nUDHI, //协议的UDHI项,是否有结构头。
  ' char* pString //解码的字符串缓冲区指针
  ' );
  '
  'int WINAPI QuerySubscriber(
  ' LPCTSTR SubID, //用户标识
  ' unsigned char* TON, //返回:号码类型
  ' unsigned char* NPI, //返回:编码方案
  ' LPTSTR SubName, //返回:用户姓名 char[MAX_ADDR_LEN]
  ' LPTSTR SubAddress, //返回:用户地址 char[MAX_SUB_ADDRESS]
  ' unsigned char* MsType, //返回:手机类型
  ' unsigned long* Service, //返回:服务级别
  ' unsigned char* bSM, //返回:是否提供短消息服务
  ' unsigned long* OCOS, //返回:最大下发数
  ' unsigned long* TCOS, //返回:最大提交数
  ' LPTSTR Password, //返回:密码 char [MAX_PASSWORD]
  ' LPTSTR RegTime //返回:注册时间 char[20]
  ' );
  '
  'int WINAPI QuerySMStatusA(
  ' unsigned long SM_ID, //短消息ID
  ' unsigned char OrgTON, //源地址号码类型
  ' unsigned char OrgNPI, //源地址编码方案
  ' LPCTSTR OrgAddr, //源地址 char[MAX_ADDR_LEN]
  ' unsigned char* DestTON, //返回:目标地址号码类型
  ' unsigned char* DestNPI, //返回:目标地址编码方案
  ' LPTSTR DestAddr, //返回:目标地址 char[MAX_ADDR_LEN]
  ' LPTSTR Final_date, //返回:最后时间 char[MAX_TIMESTAMP_LEN]
  ' unsigned char* SM_Status, //返回:短消息状态
  ' //0 : WAITING_FOR_DELIVER 表示等待发送
  ' //1 : DELIVER_SUCCESS 表示成功发送
  ' //2 : DELIVER_FAIL 表示发送失败
  ' unsigned char* Error_Code //返回:错误代码
  ' );
  '
  'int WINAPI CancelSMA(
  ' char cService_type, //参见GSM3.39说明
  ' unsigned long SM_ID, //短消息ID
  ' unsigned char OrgTON, //源地址号码类型
  ' unsigned char OrgNPI, //源地址编码方案
  ' LPCTSTR OrgAddr, //源地址 char[MAX_ADDR_LEN]
  ' unsigned char DestTON, //目标地址号码类型
  ' unsigned char DestNPI, //目标地址编码方案
  ' LPCTSTR DestAddr //目标地址 char[MAX_ADDR_LEN]
  ' );
  '
  'int WINAPI ReplaceSMEx(
  ' unsigned long SM_ID,
  ' unsigned char OrgTON,
  ' unsigned char OrgNPI,
  ' LPCTSTR OrgAddr,
  ' LPCTSTR Schedule,
  ' LPCTSTR Expire,
  ' unsigned char SRR,
  ' unsigned char DCS,
  ' unsigned char UDHI,
  ' unsigned long Default_ID,
  ' unsigned long UDLen,
  ' LPCTSTR UserData
  ' );
  '
  'int WINAPI QuerySMDetailEx(
  ' unsigned long SM_ID,
  ' unsigned char* OrgTON,
  ' unsigned char* OrgNPI,
  ' LPTSTR OrgAddr,
  ' unsigned char* DestTON,
  ' unsigned char* DestNPI,
  ' LPTSTR DestAddr,
  ' unsigned char* PRI,
  ' unsigned char* RD,
  ' unsigned char* RP,
  ' unsigned char* UDHI,
  ' unsigned char* SRR,
  ' unsigned char* MR,
  ' unsigned char* PID,
  ' unsigned char* DCS,
  ' LPTSTR Schedule,
  ' LPTSTR Expire,
  ' LPTSTR Final,
  ' unsigned char* SM_Status,
  ' unsigned char* Error_Code,
  ' unsigned long* Len,
  ' LPTSTR User_Data
  ' );
  '
  'int WINAPI GetDeliverSMEx(
  ' ULONG* sm_ID, //返回:短讯ID
  ' unsigned char* DestTON, //返回:目标地址号码类型
  ' unsigned char* DestNPI, //返回:目标地址编码方案
  ' char* DestAddr, //返回:目标地址
  ' unsigned char* OrgTON, //返回:源地址号码类型
  ' unsigned char* OrgNPI, //返回:源地址编码方案
  ' char* OrgAddr, //返回:源地址
  ' unsigned char* PRI, //返回:优先权
  ' unsigned char* RP,
  ' unsigned char* UDHI,
  ' unsigned char* PID, //返回:协议类型
  ' unsigned char* DCS, //返回:编码方案
  ' char* TimeStamp, //返回:下发时间
  ' unsigned long * UDLen,
  ' char* UserData //返回:用户数据
  ' );
  '//2000.12.12 钟CD 增加状态功能
  'int WINAPI GetDeliverSMExEx(
  ' ULONG* sm_ID, //返回:短讯ID
  ' unsigned char* DestTON, //返回:目标地址号码类型
  ' unsigned char* DestNPI, //返回:目标地址编码方案
  ' char* DestAddr, //返回:目标地址
  ' unsigned char* OrgTON, //返回:源地址号码类型
  ' unsigned char* OrgNPI, //返回:源地址编码方案
  ' char* OrgAddr, //返回:源地址
  ' unsigned char* PRI, //返回:优先权
  ' unsigned char* RP,
  ' unsigned char* UDHI,
  ' unsigned char* PID, //返回:协议类型
  ' unsigned char* DCS, //返回:编码方案
  ' char* TimeStamp, //返回:下发时间
  ' unsigned long * UDLen,
  ' char* UserData, //返回:用户数据
  ' unsigned char* StatusReport //返回:状态报告标志,0表示不是状态报告,1:表示为状态报告
  ' );
  '
  '
  '#End If