www.pudn.com > 手机短信二次开发接口.zip > test.frm


VERSION 5.00 
Begin VB.Form Form1  
   Caption         =   "DemoNkiDll_VB" 
   ClientHeight    =   3345 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   4395 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   3345 
   ScaleWidth      =   4395 
   StartUpPosition =   3  'Windows Default 
   Begin VB.CommandButton Command7  
      Caption         =   "GetRecvNum" 
      Height          =   555 
      Left            =   2625 
      TabIndex        =   5 
      Top             =   2100 
      Width           =   1410 
   End 
   Begin VB.CommandButton Command6  
      Caption         =   "GetSimNum" 
      Height          =   555 
      Left            =   2625 
      TabIndex        =   4 
      Top             =   1305 
      Width           =   1410 
   End 
   Begin VB.CommandButton Command5  
      Caption         =   "Delete" 
      Height          =   555 
      Left            =   2625 
      TabIndex        =   3 
      Top             =   480 
      Width           =   1410 
   End 
   Begin VB.CommandButton Command4  
      Caption         =   "Exit" 
      Height          =   495 
      Left            =   240 
      TabIndex        =   6 
      Top             =   2400 
      Width           =   1935 
   End 
   Begin VB.CommandButton Command3  
      Caption         =   "Recv" 
      Height          =   495 
      Left            =   240 
      TabIndex        =   2 
      Top             =   1680 
      Width           =   1935 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "Init" 
      Height          =   495 
      Left            =   240 
      TabIndex        =   0 
      Top             =   120 
      Width           =   1935 
   End 
   Begin VB.CommandButton Command2  
      Caption         =   "Send" 
      Height          =   495 
      Left            =   240 
      TabIndex        =   1 
      Top             =   840 
      Width           =   1935 
   End 
End 
Attribute VB_Name = "Form1" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Private Sub Command1_Click() 
 
    Dim aa As Long 
     
    aa = Sms_Init(0, 0, 1, 15, "+8613800200500", 0) 
     
  'lMobType 手机类型:MOBILE_GSM/MOBILE_NOKIA 
  'lConnectType 连接方式:CONNECT_CABLE/CONNECT_IRDA 
  'lPort  串口号 当lConnectType == CONNECT_IRDA , 此参数无效 
  'lTimeOut 超时时间,根据当地信号状况,值为:10-100 , 单位:秒,建议值为20 
  'pSMCA 短消息中心 
  'HWnd 用于返回信息的窗口句柄, 如果不用可置NULL或0 
  '  0 初始化成功 
  '-1 连接串口失败 
  '-2 初始化红外连接错误 
  '-3 检测不到手机 
  '-4 加密狗错误(正式版需要加密狗配合使用) 
   
 
 
 
End Sub 
 
Private Sub Command2_Click() 
 
    Dim aa As Long 
     
    aa = Sms_Send("13900000000", "这是测试信息", False, False, False) 
     
  'pNo 发送目标号码 
  'pMsg 需要发送的消息 
  'bAsyn  是否以异步方式发送,如果是的话,发送成功后将会有消息SMS_SUB发送到Sms_Init时设置的窗口 
      
  '返回 >0 if bAsyn=false 发送成功,返回为实际发出信息的数目(因为会自动分段发送,所以返回可能会大于1) 
  'if bAsyn=true 提交成功,返回发送序列号,当信息发送成功后,窗口会收到SMS_SUB的消息通知 
  ' -1 发送失败,可能是短消息中心有错 
  ' -2 发送超时,可能是串口与手机的连接出错 
  ' -3 上次短信尚未发送完毕,暂不能发送 
  ' -4 接口还没有初始化,请先调用Sms_Init 
  ' -5 未知错误 
 
 
 
End Sub 
 
Private Sub Command3_Click() 
 
    Dim szNo   As String 
    Dim szMsg  As String 
    Dim szTime As String 
    Dim aa As Long 
     
    '由于本人对VB不熟,只能通过以下方法定义足够长的空间以便接收消息,如果你有好建议,请将更改后程序发给给我。 
   szNo = "                                                " 
   szMsg = "                                                                                                                                        " 
   szTime = "                                              " 
     
    aa = Sms_Get2(szNo, szMsg, szTime) 
 
End Sub 
 
Private Sub Command4_Click() 
 
    Dim aa As Long 
     
    aa = Sms_Exit() 
 
End Sub 
 
Private Sub Command5_Click() 
 
    Dim aa As Long 
    aa = Sms_Delete(1)  '删除Sim卡中的第一条记录 
 
End Sub 
 
Private Sub Command6_Click() 
    Dim aa As Long 
     
    aa = Sms_GetSimNum() 
 
End Sub 
 
Private Sub Command7_Click() 
    Dim aa As Long 
     
    aa = Sms_GetRecvNum() 
 
End Sub