How can I edit an incoming text message (sms) as it arrives in windows mobile 6 using managed code

Posted by x86shadow on Stack Overflow See other posts from Stack Overflow or by x86shadow
Published on 2010-03-27T17:36:08Z Indexed on 2010/03/27 18:03 UTC
Read the original article Hit count: 250

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!!!
        }
    }
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about windows-mobile