home *** CD-ROM | disk | FTP | other *** search
/ PC User 2002 March / Disc 1 / PCU030201.iso / software / utils / files / activesms.exe / data1.cab / Example_Files / Samples / VB / frmActiveSMS.frm (.txt) next >
Encoding:
Visual Basic Form  |  2001-12-19  |  5.6 KB  |  154 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
  3. Object = "{B5A35CF1-F3F2-419B-B489-710924065829}#1.0#0"; "ActiveSMSClient.dll"
  4. Begin VB.Form frmActiveSMS 
  5.    Caption         =   "ActiveSMS"
  6.    ClientHeight    =   5400
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   5520
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5400
  12.    ScaleWidth      =   5520
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.Frame Frame2 
  15.       Caption         =   "Outgoing Message"
  16.       Height          =   2415
  17.       Left            =   120
  18.       TabIndex        =   2
  19.       Top             =   120
  20.       Width           =   5295
  21.       Begin VB.CommandButton SendMessage 
  22.          Caption         =   "Send Message"
  23.          Height          =   375
  24.          Left            =   1560
  25.          TabIndex        =   7
  26.          Top             =   1920
  27.          Width           =   1455
  28.       End
  29.       Begin VB.TextBox tbMessage 
  30.          Height          =   975
  31.          Left            =   1560
  32.          TabIndex        =   6
  33.          Top             =   840
  34.          Width           =   3495
  35.       End
  36.       Begin VB.TextBox tbNumber 
  37.          Height          =   285
  38.          Left            =   1560
  39.          TabIndex        =   4
  40.          Text            =   "44"
  41.          Top             =   310
  42.          Width           =   2415
  43.       End
  44.       Begin VB.Label Label2 
  45.          Alignment       =   1  'Right Justify
  46.          Caption         =   "Text:"
  47.          Height          =   255
  48.          Left            =   960
  49.          TabIndex        =   5
  50.          Top             =   840
  51.          Width           =   495
  52.       End
  53.       Begin VB.Label Label1 
  54.          Alignment       =   1  'Right Justify
  55.          Caption         =   "Phone Number:"
  56.          Height          =   255
  57.          Left            =   240
  58.          TabIndex        =   3
  59.          Top             =   360
  60.          Width           =   1215
  61.       End
  62.       Begin ACTIVESMSCLIENTLibCtl.ActiveSMSListener MsgListener 
  63.          Left            =   4440
  64.          OleObjectBlob   =   "frmActiveSMS.frx":0000
  65.          Top             =   240
  66.       End
  67.    End
  68.    Begin VB.Frame Frame1 
  69.       Caption         =   "Incoming Messages"
  70.       Height          =   2655
  71.       Left            =   120
  72.       TabIndex        =   0
  73.       Top             =   2640
  74.       Width           =   5295
  75.       Begin ComctlLib.ListView lvIncomingMsgs 
  76.          Height          =   2295
  77.          Left            =   120
  78.          TabIndex        =   1
  79.          Top             =   240
  80.          Width           =   5055
  81.          _ExtentX        =   8916
  82.          _ExtentY        =   4048
  83.          View            =   3
  84.          LabelWrap       =   -1  'True
  85.          HideSelection   =   -1  'True
  86.          _Version        =   327682
  87.          ForeColor       =   -2147483640
  88.          BackColor       =   -2147483643
  89.          BorderStyle     =   1
  90.          Appearance      =   1
  91.          NumItems        =   3
  92.          BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  93.             Key             =   ""
  94.             Object.Tag             =   ""
  95.             Text            =   "Phone Number"
  96.             Object.Width           =   2540
  97.          EndProperty
  98.          BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  99.             SubItemIndex    =   1
  100.             Key             =   ""
  101.             Object.Tag             =   ""
  102.             Text            =   "Text"
  103.             Object.Width           =   2540
  104.          EndProperty
  105.          BeginProperty ColumnHeader(3) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  106.             SubItemIndex    =   2
  107.             Key             =   ""
  108.             Object.Tag             =   ""
  109.             Text            =   "Handset"
  110.             Object.Width           =   1764
  111.          EndProperty
  112.       End
  113.    End
  114. Attribute VB_Name = "frmActiveSMS"
  115. Attribute VB_GlobalNameSpace = False
  116. Attribute VB_Creatable = False
  117. Attribute VB_PredeclaredId = True
  118. Attribute VB_Exposed = False
  119. Option Explicit
  120. Dim ActiveSMS As New ACTIVESMSCLIENTLib.ActiveSMS
  121. Private Sub Form_Load()
  122.     'Listener should be enabled after form load to
  123.     'prevent loss of messages
  124.     MsgListener.Enabled = True
  125. End Sub
  126. Private Sub SendMessage_Click()
  127.     Dim MessageId As Integer
  128.     MessageId = ActiveSMS.SendMessage(tbNumber, tbMessage, 20000)    '20000 = 20secs
  129.     Dim Status As ACTIVESMSCLIENTLib.EnumJobStatus
  130.     Status = ActiveSMS.GetSendStatus(MessageId)
  131.     Select Case Status
  132.     Case ACTIVESMSCLIENTLib.jsSent
  133.         MsgBox "Message has been sent"
  134.     Case ACTIVESMSCLIENTLib.jsErrTimeout
  135.         MsgBox "Message not sent, Server too busy [Non-Queued Mode]"
  136.     Case ACTIVESMSCLIENTLib.jsErrNumberInvalid
  137.         MsgBox "Message not sent, Invalid Number"
  138.     Case ACTIVESMSCLIENTLib.jsPending, ACTIVESMSCLIENTLib.jsProcessing
  139.         MsgBox "Message has been queued"
  140.     Case ACTIVESMSCLIENTLib.jsErrNetworkFailure
  141.         MsgBox "Message not sent, Failure reported by phone network"
  142.     Case ACTIVESMSCLIENTLib.jsErrPhoneCommsError
  143.         MsgBox "Message not sent, Error communicating with handset"
  144.     Case Else
  145.         MsgBox "Message not sent, Internal error occured (see EventLog)"
  146.     End Select
  147. End Sub
  148. Private Sub MsgListener_OnMessageReceived(ByVal PhoneNumber As String, ByVal Message As String, ByVal Handset As Long)
  149.     Dim Item As ListItem
  150.     Set Item = lvIncomingMsgs.ListItems.Add(, , PhoneNumber)
  151.     Item.SubItems(1) = Message
  152.     Item.SubItems(2) = Handset
  153. End Sub
  154.