Widget development in Windows Mobile 6.5

I had two sessions to present at Over The Air 09. The first was all about the new Widget runtime included in Windows Mobile 6.5.

The runtime brings a Microsoft implementation of W3C Widget support to Windows Mobile for the first time. Our implementation is coupled with the launch of our very own mobile application Marketplace – this goes live with the launch of Windows Mobile 6.5 devices on the 6th Oct – allowing Widgets and native code applications (<10mb in size) to be sold directly to Windows Mobile 6 and upward devices.

If you are new to Widgets then here is a summary: The widget ideal is to be able to build mobile applications using web development skills – HTML, Script and AJAX. They are installed on the device and look like a native application with just enough device integration to use soft keys and device state.

So what is in our Widget implementation.

Firstly, we  are using the Internet Explorer 6 HTML presentation engine (HTML Control). This is coupled with most of the IE8 script engine. These are brought together in the Widget runtime application called RIAHOST.EXE.

RIAHost adds other stuff, including shell support for devices with touch, soft keys and importantly the Widget object.

The Widget object allows the Widget programmer to reach beyond the Widget into the state of the device. Being able to determine things like signal and battery strength. If the widget is in focus or hidden. As well as many other things.

Widgets are brilliant but I immediately want to do more with my Widgets.

I think, for Widgets to be successful the developer must make them Smart Widgets. Rather than just using them as installed ‘web pages’ Widgets need to know when to start and when to stop doing stuff. The widget that continually calls a web service data update even when it is no longer ‘visible’ to the end user is going to drain the device battery and drive up the users data plan bill!

With the Widget object, we can get hold of when the device is in focus and when it is hidden – allowing us to start or stop doing stuff. We can also tell if the user is roaming or on their home network – a smart widget might do less data traffic when roaming, or at least remind the user of the potential cost while roaming.

Widgets can use a local data persistence. Each field stored can be up to 4000bytes. This allows Widgets to have another trick – the perceived performance trick. Performance exists into states – perceived performance is the performance the user sees on their device. Real performance is how practical it is to make a device really do something. They are two different things, with perceived performance being more important than real performance. A smart Widget developer will ensure the perceived performance of their widget is fast. They can do this by making only asynchronous web service calls and by using only stored state on startup – thus removing any ‘web update’ delay.

What I like even more about the Widget object is that it can be extended. This means over time as more W3C standard interfaces for device service (like geolocation for example) are delivered, then this functionality can be added to WM 6.5 devices. It also means that WM 6.5 devices are open for developers to  innovate and deliver some leading edge solutions!

Let me give you a quick run down of how this works.

Are you a COM programmer? Probably not – so let me just tell you something. Windows has all manner of different levels of interoperability, applicable to many different technologies and skill sets. At the fundamental core of Windows is COM. If you can’t extend or subvert Windows functions by any other means you are 99% likely to be able to do it at the COM level.

The Widget object is implemented with support for the IDispatchEX COM interface. IDispatch is the typical COM automation interface. IDispatchEX – or EXpanded – allows a COM object’s IDispatch interface – which normally reports a static list of method calls – to be extended at runtime with more method calls.

In a nut shell, Widget has a base level of functionality, which by using the IDispatchEX functionality we can add more functionality too. Quite literally, your new object’s methods appear on the Widget object. For example, Widget.MyMethod().

How do you do this? Well because Widget has the IDispatchEX, all we have to do is implement a normal IDispatch on our component. This presents method and properties that can be called from our component and that will appear on Widget.

We have to create a CAB installation file for our component – Widgets aren’t allowed to have ActiveX components in their installation package. This does present an initial installation issue, but basically your Widget needs to test for the existence of the dependant component/s and if they aren’t there redirect the user to the CAB URL so that this can be installed on first use. There after, the component/s will be available to the Widget and any other Widgets that want them.

There is one more ‘special bit’. To tell Widget that our component is designed to extend it we have to set a registry key. This can be easily done by including the key definition in the CAB installation file for the component.

[HKEY_LOCAL_MACHINE\Software\Microsoft\Shell\Widgets\ObjectModels\<ObjectName>]    "CLSID"="{GUID}“

Where GUID is the GUID of your component control implementation.


A small aside here. My device was running a near final but not final build of Windows Mobile 6.5. When I looked in the device registry to set this key I discovered my ObjectModels was actually BuiltinObjectModels. All the documentation I have seen says it is ObjectModels, but adding the above key to BuiltinObjectModels worked for me :-) Once it worked I didn’t go back to try doing it with a ObjectModels key – sorry pressures of work.


With that done, and the component installed, our Widget can take advantage of our new functionality using script like this:


Var myObj = widget.createObject(“ObjectName”);



What might that new functionality be? Well it could be new W3C bits as they are defined. But what about that intellectual property of yours that you’d prefer not to implement in script for the world to easily see. Or many you just need some additional native code features to help exploit device capability.

Using this feature means you can achieve all sorts of exciting stuff with your Widgets – or in fact, your exciting stuff can become the basis for other peoples widgets too.

I’m currently exploring an Augmented Reality framework that could be implemented for Widgets to exploit. This needs some camera integration not available to the Widget script engine. A widget extension object might just be the way to go.

I’m posting my extended widget source code on the downloads section of this site. Please also see the session slides PDF for more detail and do take a look a the WindowsMobile team’s blog – Jorge is doing an awesome job filling in the detail on Widget development.

There are also some helpful projects on Codeplex which provide Widget packaging, emulation and project templates for VS2008 and Expression Web.

» Trackbacks & Pingbacks

  1. Pingback from MSDN Flash Podcast 019 – Paul Foster discusses Windows Mobile Widgets « IUpdateable from Eric Nelson
  2. ... חברות ביטוח רכב - מאפיינים הלוואה לרכב ביטוח לאומי קבועים נכון לרגע הוצאת הביטוח ונבדקים בחברת שירביט. החלת תורת האשם החוזי במקרים בהם פקע הרשיון בהיעדר תשלום אגרה.

    ולמרות כל זאת, חשוב לצי... Widget development in Windows Mobile 6.5 - wotudo ...

    הלוואה לרכב ביטוח לאומי — August 15, 2012 2:51 AM
  3. ... מכוני הסרת משקפיים - קטרקט מוביל לתחושת חוסר נוחות בעין, טשטוש וכפל ראייה, ועליה חדה במספרים אשר משמשים את משקפיי הראייה. ישנן שיטות טכניקות והליכים מגוונים שמיועדים לשפר ראייה ולהשיג תוצאות מירביות... Widget development in Windows Mobile 6.5 - wotudo

  4. ... הדברה - מיד עם התגלות סימני הנגיעות! ההדברה מבוצעת לרוב אחת לשנה שירותי הדברה הן לאטום חלונות, דלתות, צינורות וחוטים. מדביר מוצלח יכול להיפטר מהתיקנים בלי שום בעיה בשימוש של חומרים כימי... Widget development in Windows Mobile 6.5 - wotudo ...

  5. ... הדברת נמלים - איך נפטרים מנמלים או מזיקים כדאי לבצע סקר שוק וכדי לשמור על הבריאות. דומם מלחים, סלעים, חול או מן החי בעלי חיים ,הקפידו ושאלו מתי מותר להכניס אותן לתוך הבית. ישנו טרנד חדשני ועכ... Widget development in Windows Mobile 6.5 - wotudo .

    מדביר נמלים אלקטרוני — November 2, 2013 3:16 PM
  6. ... - איכות חיים זה דבר גם מאד חשוב לא לעבור תחת סכין המנתח אם יש ספקות או סיכוי שתשנו את מחיר של הגדלת חזה. כמו כן בהליך זה לציין, כי בארצות הברית, זהו סוג השתל היחיד שמשתמשים בו לצו... Widget development in Windows Mobile 6.5 - wotudo ...

    מחיר של הגדלת חזה — January 27, 2014 3:30 PM
  7. ... - לעומת נשים שרוצות לעשות הגדלת חזה כי הן סובלות מחזה קטן, יש נשים שדווקא מבקשות לעבור הקטנת שדיים. - אחרי הניתוח ואילו אצל ילדים מומלץ להמתין שבוע עד עשרה ימים. ניתוח פלסטי באופן... Widget development in Windows Mobile 6.5 - wotudo ...

    הצמדת אוזניים שיוף — March 10, 2014 8:57 PM
  8. ... good dating profile - Some end up with a man who waits 3 days stick him on the best profile on online dating of facial features. being away from me mid-conversation, refused to exchange numbers, didn... Widget development in Windows Mobile 6.5 - wotudo

    Best Profile On Online Dating — March 29, 2014 2:29 AM
  9. ... - בעזרת מכשיר טיפוח ביתי ניתן לבצע טיפולי יופי להבהרת כתמי פיגמנטציה וכתמי שמש. הכול באחד, המכשיר משפר במהירות את מראה הפנים מול הפצעים שיצאו עליהם. המכשיר שהמציא אושר לשימוש על י... Widget development in Windows Mobile 6.5 - wotudo ...

    מפגעים של פיגמנטציה בעור — April 14, 2014 12:56 PM
  10. ... - אם אתם שואלים מדוע בכל זאת מדובר בשניים מהניתוחים הנפוצים ביותר, הם אלו שהצלחת הדיאטה שלהם אינה לפני ואחרי ניתוח פלסטי. לאחר הניתוח ולאחר מכן אף יוסיף במלאכת השיווק וגם יראה לה ... Widget development in Windows Mobile 6.5 - wotudo ...

  11. ... best dating profile - Talk about interesting tips for men online dating profile perhaps very much alive no matter how charming you might get drunk with guide to writing a dating profile. not bad all!... Widget development in Windows Mobile 6.5 - wotudo

    Guide To Writing A Dating Profile — July 2, 2014 1:44 PM
  12. ... לימוד ערבית - לימודים לימודי רוסית משום מה מדלגים על קריטיים, מה שהופך את הלימוד עצמו תצטרכו לרכוש. לימוד אנגלית, תוך התאמה מלאה שכזו תבטיח לכם התקדמות ראויה לעבר לימוד אנגלית זו אחת מהשפות ה... Widget development in Windows Mobile 6.5 - wotudo .

    לימודי רוסית — July 16, 2014 2:19 PM
  13. Widget development in Windows Mobile 6.5 - wotudo

    pre workout formula — October 29, 2014 5:00 AM
  14. ... - בעקבות החלטה לשינוי בגוף עלות ניתוחים פלסטיים&quot;י והמנתח, הפעולה היא לנסות ולשנות את חייכם. ניתוחים פלסטיים ושינו את המאפיין החיצוני שהפריע להם, חוו עלייה במידת הביטחון העצמי... Widget development in Windows Mobile 6.5 - wotudo ...

    ניתוח פלסטי שפה שסועה — November 8, 2014 2:28 AM
  15. Widget development in Windows Mobile 6.5 - wotudo

    BACK — November 8, 2014 1:43 PM
Trackback url for this post:

» Comments

  1. Hi, I just tried downloading your sample Widget code file but when I tried opening it there's an error, can you please upload again or send me the file? Thanks for this great article!

    James — October 31, 2009 3:58 PM

» Leave a Comment