T
Tym
Hi guys and gals!
Been trying to program following Maarten Struys' demos on the SMS
intereception and I'm having severe problems.
First of all, I'm a VBer not VC, though for this I have tried to work my way
through VC!!
I took the BASIC code from Marteen's example, and derived this:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile;
using Microsoft.WindowsMobile.Status;
using Microsoft.WindowsMobile.PocketOutlook ;
using Microsoft.WindowsMobile.PocketOutlook.MessageInterception;
namespace DeviceApplication1
{
public partial class Form1 : Form
{
private MessageInterceptor sms;
private SystemState networkConnectionState;
private SystemState cradleState;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
sms = new
MessageInterceptor(InterceptionAction.NotifyAndDelete);
sms.MessageCondition = new MessageCondition(MessageProperty.Body
, MessagePropertyComparisonType.StartsWith , "123456");
sms.MessageReceived += new
MessageInterceptorEventHandler(sms_MessageReceived);
}
void sms_MessageReceived(object sender, MessageInterceptorEventArgs
e)
{
Msgbox("SMS RECEIVED");
}
}
}
Now, the only it here that doesn't work is the Msgbox - why? what's the VC
equivalent??? (in compactframework - there's one in VB!)
That aside, converting this to VB gives:
Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports Microsoft.WindowsMobile
Imports Microsoft.WindowsMobile.Status
Imports Microsoft.WindowsMobile.PocketOutlook
Imports Microsoft.WindowsMobile.PocketOutlook.MessageInterception
Public partial Class Form1
Inherits Form
Private sms As MessageInterceptor
Private networkConnectionState As SystemState
Private cradleState As SystemState
Public Sub New()
InitializeComponent()
End Sub
Private Sub New_Load(ByVal sender As Object, ByVal e As EventArgs)
sms = New MessageInterceptor(InterceptionAction.NotifyAndDelete)
sms.MessageCondition = New MessageCondition(MessageProperty.Body
, MessagePropertyComparisonType.StartsWith , "123456")
sms.MessageReceived += New
MessageInterceptorEventHandler(sms_MessageReceived)
End Sub
Private Sub sms_MessageReceived(ByVal sender As Object, ByVal e As
MessageInterceptorEventArgs)
Msgbox("SMS RECEIVED")
End Sub
End Class
'----------------------------------------------------------------
' Converted from C# to VB .NET using CSharpToVBConverter(1.2).
' Developed by: Kamal Patel (http://www.KamalPatel.net)
'----------------------------------------------------------------
[Credit left in obviously! Thanks Kamal!]
Now with this, the "sms.MessageReceived" is underlined blue, with the error
message:
'Public Event MessageReceived(sender As Object, e As
Microsoft.WindowsMobile.PocketOutlook.MessageInterception.MessageInterceptorEventArgs)'
is an event, and cannot be called directly. Use a 'RaiseEvent' statement to
raise an event
I'm afraid that
http://msdn2.microsoft.com/en-us/library/fwd3bwed(vs.80).aspx doesn't
explain it enough for me and I still can't get it to work.
The "sms_MessageReceived" si also underlined blue with:
'Microsoft.WindowsMobile.PocketOutlook.MessageInterception.MessageInterceptorEventHandler'
is a delegate type and requires a single 'addressof' expression as the only
argument to the constructor.
What gets me is that EXACTLY the same code is OK in VC but not VB. Also, the
intellisense in VC is supoerb - why does my VB environment not give
it??!?!?!
Tym
Been trying to program following Maarten Struys' demos on the SMS
intereception and I'm having severe problems.
First of all, I'm a VBer not VC, though for this I have tried to work my way
through VC!!
I took the BASIC code from Marteen's example, and derived this:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile;
using Microsoft.WindowsMobile.Status;
using Microsoft.WindowsMobile.PocketOutlook ;
using Microsoft.WindowsMobile.PocketOutlook.MessageInterception;
namespace DeviceApplication1
{
public partial class Form1 : Form
{
private MessageInterceptor sms;
private SystemState networkConnectionState;
private SystemState cradleState;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
sms = new
MessageInterceptor(InterceptionAction.NotifyAndDelete);
sms.MessageCondition = new MessageCondition(MessageProperty.Body
, MessagePropertyComparisonType.StartsWith , "123456");
sms.MessageReceived += new
MessageInterceptorEventHandler(sms_MessageReceived);
}
void sms_MessageReceived(object sender, MessageInterceptorEventArgs
e)
{
Msgbox("SMS RECEIVED");
}
}
}
Now, the only it here that doesn't work is the Msgbox - why? what's the VC
equivalent??? (in compactframework - there's one in VB!)
That aside, converting this to VB gives:
Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports Microsoft.WindowsMobile
Imports Microsoft.WindowsMobile.Status
Imports Microsoft.WindowsMobile.PocketOutlook
Imports Microsoft.WindowsMobile.PocketOutlook.MessageInterception
Public partial Class Form1
Inherits Form
Private sms As MessageInterceptor
Private networkConnectionState As SystemState
Private cradleState As SystemState
Public Sub New()
InitializeComponent()
End Sub
Private Sub New_Load(ByVal sender As Object, ByVal e As EventArgs)
sms = New MessageInterceptor(InterceptionAction.NotifyAndDelete)
sms.MessageCondition = New MessageCondition(MessageProperty.Body
, MessagePropertyComparisonType.StartsWith , "123456")
sms.MessageReceived += New
MessageInterceptorEventHandler(sms_MessageReceived)
End Sub
Private Sub sms_MessageReceived(ByVal sender As Object, ByVal e As
MessageInterceptorEventArgs)
Msgbox("SMS RECEIVED")
End Sub
End Class
'----------------------------------------------------------------
' Converted from C# to VB .NET using CSharpToVBConverter(1.2).
' Developed by: Kamal Patel (http://www.KamalPatel.net)
'----------------------------------------------------------------
[Credit left in obviously! Thanks Kamal!]
Now with this, the "sms.MessageReceived" is underlined blue, with the error
message:
'Public Event MessageReceived(sender As Object, e As
Microsoft.WindowsMobile.PocketOutlook.MessageInterception.MessageInterceptorEventArgs)'
is an event, and cannot be called directly. Use a 'RaiseEvent' statement to
raise an event
I'm afraid that
http://msdn2.microsoft.com/en-us/library/fwd3bwed(vs.80).aspx doesn't
explain it enough for me and I still can't get it to work.
The "sms_MessageReceived" si also underlined blue with:
'Microsoft.WindowsMobile.PocketOutlook.MessageInterception.MessageInterceptorEventHandler'
is a delegate type and requires a single 'addressof' expression as the only
argument to the constructor.
What gets me is that EXACTLY the same code is OK in VC but not VB. Also, the
intellisense in VC is supoerb - why does my VB environment not give
it??!?!?!
Tym