how to edit a 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 17:43 UTC
Read the original article Hit count: 287

I want to make an application to be installed on two pocket PCs and send Encrypted text messages and receive and decrypt them on the other device. I already made an application that gets special text messages ( starting with !farenc! ) and I know how to Encrypt/Decrypt the messages as well but I don't know how to edit a text message as it's arrive ( for decryption ). please help.

thanks in advance and sorry for my bad English

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