Archive for July, 2008

There is an extremely easy way to intercept SMS in WM2005. Microsoft.WindowsMobile.PocketOutlook provides many useful objects to manipulate Pocket Outlook in WM devices. I am particularly interested with the MessageInterceptor object.

In this tutorial, I will share with you a simple Proof-of-Concept WM device application using MessageInterceptor object. This application intercepts a SMS and renders the message body into a QRcode on the form.

A free .NET QRcode encoder for both desktop and compact framework is found at http://www.codeproject.com/KB/cs/qrcode.aspx

First things first

I assume you have/know the following:
• A WM2005 or above phone device to test with (I can rent you one…)
• Visual Studio 2005 with the relevant Windows Mobile SDK
• You know how to create a simple WM “device-application” project

Adding References & Namespaces

Add Microsoft.WindowsMobile & Microsoft.WindowsMobile.PocketOutlook

In your Form1.cs (or whatever your form class file is), add these:

using Microsoft.WindowsMobile.PocketOutlook;
using Microsoft.WindowsMobile.PocketOutlook.MessageInterception;
using System.Drawing.Imaging;
using ThoughtWorks.QRCode.Codec;
using ThoughtWorks.QRCode.Codec.Data;
using ThoughtWorks.QRCode.Codec.Util;

Adding UI Elements

In this example, I used a PictureBox, Listbox & 2 Buttons.

Adding Interceptor object & handler

Declare MessageInterceptor in the class for the Form since we want to intercept message throughout the lifespan of the form. In other words, DO NOT CREATE a local object inside a method.

public partial class Form1 : Form

{
MessageInterceptor nSms;

public Form1()

{

InitializeComponent();

}

Instantiate the interceptor during Form load:

private void Form1_Load(object sender, EventArgs e)

{

nSms = new MessageInterceptor();

nSms.MessageReceived +=new MessageInterceptorEventHandler(nSms_MessageReceived);

}

In this case, nSms_MessageReceived is the delegated handler and it looks something like this:

void nSms_MessageReceived(object sender, MessageInterceptorEventArgs e)

{

if (e.Message is SmsMessage)

{

SmsMessage sms = (SmsMessage)e.Message;

listBox1.Items.Add(sms.Body);

createQR(sms.Body);

this.Show();

}

else

listBox1.Items.Add(“unknown message”);

listBox1.Items.Add(e.Message.From.Address.ToString());

listBox1.Items.Add(e.Message.From.Name.ToString());

}

Sending SMS

Sending SMS in a WM device app is a no brainer…

private void button1_Click(object sender, EventArgs e)

{

SmsMessage a = new SmsMessage(“91234567″, “The quick brown fox jump over the dead dog”);

a.Send();

}

Let’s waste some SMS

At this point in time, give yourself a pat and waste some SMS by sending some to the device running this application.

Anyone who’d experienced development with COM-based Pocket Outlook Object Model or POOM will appreciate this tutorial because it is now almost idiot-proof and painless compared to using POOM.

I deliberately left out the QRcode encoding and leave it to your imagination to what you can do with intercepted SMS. The reader may wish to explore the free QRcode encoder for some hands-on exercise.

Related posts:

    I believe I have the responsibility over my own destiny.

    I believe in seeking opportunities over being a mindless droid.

    I believe in a culture that values entrepreneurial spirit, innovation and knowledge-application over power, politics and hidden agenda.

    Yes, I finally am declaring to CrimsonLogic (parent of my current company RadianTrust) my ownership of Ennovative Pte Ltd, which operates SMSPerks service, a customer-loyalty and marketing system. So why declare? Why even attempt different things altogether?

    First of all, I enjoy transparency, security and technology. I like new challenges and ownership is in my blood. Ownership is a matter of attitude, not paper deeds. Ennovative is not my first attempt. In fact, I’d lost money & pride before I even started making any with Gladiators Zone (the first few cyber-cafe in Singapore) with a paid-up capital of 200K together with a good friend. We were about 21 years old then, stubborn & inexperience. It was an expensive yet useful lesson.

    If it is not now, when should I start again? The opportunities are there now, I have to seize them!

    I am excited for SMSPerks as Sean & myself are working closely together with Central’s (中環茶餐廳) preparation of promotions. The responses are excellent so far, with 184 new members within a month of launch and healthy loyalty-points activities too! We are in the midst of preparing SMSPerks for Breadstory (Malaysia), a popular pastry franchise, makers of excellent goodies.. yum yum!

    As for conflict of interest, I currently do not see any since RadianTrust at present, focuses on different sectors and areas, particularly optical document & web security. Holding a employee-owner dual identity (no, I am not batman) allows me to exercise my technical & business skill-sets, allows me to see things from two perspectives in both worlds, RT & Ennovative despite the very different nature of businesses.

    In fact, I believe in a span of less than a year with RT, I am responsible for key product evolution in terms of security-feature generation and verification. Of course, it is achieved together with my team under the supervision of my capable product manager.

    I look forward to more Phidelity appliances sales along with my patent pending invention (together with our resident Guru C.C.K): Secure Virtual Printer driver, a simple and yet important piece of enabler that brings optical document security to the masses.

    SVP eliminates complex software development and lowers Total Cost of Ownership compared to other optical security solutions.

    Optical security features are now within the reach of most productivity software (eg. MS Office, Adobe PDF reader etc), simply with a click of the print button! All you need are SVP, Laser Printer and Phidelity Server!

    Your documents are worth it! Contact us for more info. sales@radiantrust.com

    Even as I write this entry, I am very glad not just for myself, but for Glynis & Jia Hua, two of my close friends. For they too have found their own passion, writing their own destiny as entrepreneurs. Our adventures are just beginning…

    Related posts:

      Related posts:

        Related posts:

          Please help save Ivan, son of Andrii Nikitin (MySQL Support Engineer), who needs a bone marrow transplant. Andrii’s message is below:

          “My family got bad news - doctors said allogenic bone marrow transplantation is the only chance for my son Ivan.

          “8 months of heavy and expensive immune suppression brought some positive results so we hoped that recovering is just question of time.

          “Ivan is very brave boy - not every human meets so much suffering during whole life, like Ivan already met in his 2,5 years. But long road is still in front of us to get full recover - we are ready to come it through.

          “Ukrainian clinics have no technical possibility to do such complex operation, so we need 150-250K EUR for Israel or European or US clinic. The final decision will be made considering amount we able to find. Perhaps my family is able to get ~60% of that by selling the flat where parents leave and some other goods, but we still require external help.”

          – Andrii Nikitin, MySQL Engineer

          For donation: Donation can be made through PayPal (via MySQL/Sun website)

          Related posts: