VISUAL BASIC 2008 - WINDOWS MOBILE SMS RECEIVE TROUBLE

Joined
Aug 5, 2011
Messages
2
Reaction score
0
Hallo,

please I have very big trouble. Many days I try develope application for receiving SMS, but I cant this.


This is my code:



Imports Microsoft.WindowsMobile.PocketOutlook.MessageInterception
Imports Microsoft.WindowsMobile.Telephony
Imports Microsoft.WindowsMobile
Imports Microsoft.WindowsMobile.PocketOutlook
Imports System.Messaging
Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports Microsoft.WindowsMobile.Status


Public Class Form1

Private _smsInterceptor As MessageInterceptor
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
If MessageInterceptor.IsApplicationLauncherEnabled(_appId) Then
_smsInterceptor = New MessageInterceptor(_appId)
Else
_smsInterceptor = New MessageInterceptor(InterceptionAction.Notify)
_smsInterceptor.MessageCondition =
New MessageCondition(MessageProperty.Body, _
MessagePropertyComparisonType.StartsWith,
"www")
End If

AddHandler _smsInterceptor.MessageReceived, New MessageInterceptorEventHandler(AddressOf SmsInterceptor_MessageReceived)
Display(
"Event Wired")
End Sub
Sub Display(ByVal text As String)
TextBox1.Text &= text & vbCrLf
End Sub
Private Sub SmsInterceptor_MessageReceived(ByVal sender As Object, ByVal e As MessageInterceptorEventArgs)
Display(
"Received")
Dim theMessage As SmsMessage = TryCast(e.Message, SmsMessage)
If Not theMessage Is Nothing Then
Display("Msg: " & theMessage.From.Address & " - " & theMessage.Body)
End If
End Sub
Const _appId As String = "sms"


Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If MessageInterceptor.IsApplicationLauncherEnabled(_appId) Then
_smsInterceptor = New MessageInterceptor(_appId)
Else
_smsInterceptor = New MessageInterceptor(InterceptionAction.Notify)
_smsInterceptor.MessageCondition =
New MessageCondition(MessageProperty.Body, _
MessagePropertyComparisonType.StartsWith,
"www")
End If

AddHandler _smsInterceptor.MessageReceived, New MessageInterceptorEventHandler(AddressOf SmsInterceptor_MessageReceived)
End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
_smsInterceptor.EnableApplicationLauncher(_appId)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
_smsInterceptor.DisableApplicationLauncher()
End Sub
End
Class


But trouble is, that this
AddHandler _smsInterceptor.MessageReceived, New MessageInterceptorEventHandler(AddressOf SmsInterceptor_MessageReceived)

I thing that this not see incomming message?

Idont know , what can I do, please very much, very,very, I need help, please for advice.

I have windows mobile 6.3
All is functioned, but receiving sms I cant solve,
please for advice


 
Back
Top