How can I edit an incoming text message (sms) as it arrives in windows mobile 6 using managed code
- by x86shadow
I want to make an application for pocket PCs to send and receive Encrypted text messages.
I have already made an application that gets special text messages ( starting with !farenc! ) and I know how to Encrypt/Decrypt the messages as well.
The problem is that I don't know how to edit a text message after it's arrived (for decryption).
See code below for more info.
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile;
using Microsoft.WindowsMobile.PocketOutlook;
using Microsoft.WindowsMobile.PocketOutlook.MessageInterception;
namespace SMSDECRYPT
{
public partial class Form1 : Form
{
MessageInterceptor _SMSCatcher = new MessageInterceptor(InterceptionAction.Notify, true);
MessageCondition _SMSFilter = new MessageCondition();
public Form1()
{
InitializeComponent();
_SMSFilter.Property = MessageProperty.Body;
_SMSFilter.ComparisonType = MessagePropertyComparisonType.StartsWith;
_SMSFilter.CaseSensitive = true;
_SMSFilter.ComparisonValue = "!farenc!";
_SMSCatcher.MessageCondition = _SMSFilter;
_SMSCatcher.MessageReceived += new MessageInterceptorEventHandler(_SMSCatcher_MessageReceived);
}
private void Form1_Load(object sender, EventArgs e)
{
//...
}
void _SMSCatcher_MessageReceived(object sender, MessageInterceptorEventArgs e)
{
SmsMessage mySMS = (SmsMessage)e.Message;
string sms = mySMS.Body.ToString();
sms = sms.Substring(8);
//Decryption
//...
//Update the received message and replace it with the decrypted text
//!!!HELP!!!
}
}
}