Blog

  • Summer Rain

    As I walked to the local Tesco’s to pick up something to eat for lunch today it was, unsurprisingly, raining steadily. Keeping my head down and a stiff upper lip etc I kept going. As I looked down at the pavement to avoid the puddles I spotted a metal drain cover with the words “Wash Out” on it. This basically sums up the summer so far…


    (When the weather is slightly more clement I plan to take a camera out and get a picture for my collection)

  • Context Menu Extensions Windows Mobile 2003 versus Windows Mobile 5.0/6

    One of the features of Mobile In The Hand is the ability to add context menu extension handlers for the PIM applications from managed code. One of the problems with implementing this feature is that the behaviour of these applications varies subtly between versions and these differences are rarely documented from the developers perspective.


    One of these issues is the way that context menu extensions work with regard to multiple item selection. In Windows Mobile 2003 the Tasks and Contacts applications allow the user to select multiple items on Pocket PC using the stylus. When the context menu extension is called you can get the Oids of all the items selected. However in Windows Mobile 5.0 the Contacts user interface was changed and no longer supports multiple selection, but Tasks still behaves as before (Tasks has always been the neglected application of Pocket Outlook – just look at how limited Tasks was on Smartphones prior to Windows Mobile 6 Standard). However if you select multiple tasks on Windows Mobile 5.0 or 6 the context menu will only get the Oid of the first item. You therefore need to set your (and your users) expectations when using Context Menus within your solutions.

  • Visual Studio 2008 Launch Date Announced

    At Microsoft’s Worldwide Partner Conference Kevin Turner announced the “2008 Global Launch Wave”. This will include Visual Studio 2008 (Orcas), SQL Server 2008 and Windows Server 2008 (Longhorn Server). The occasion will be marked on 27th February 2008 in Los Angeles – Mark you diaries ๐Ÿ™‚ Some more information here:-


    http://entmag.com/news/article.asp?EditorialsID=8800

  • .NET Micro Framework Book on special offer

    Rob Miles has just blogged that his book “Embedded Programming with the Microsoft .NET Micro Framework” is currently on special offer at Computer Manuals through the MSDN Flash email newsletter. So if you have a wobbly table, or a door you want to prop open now is the time to buy (just kidding) ๐Ÿ™‚


    For exactly the same reasons you might want to grab the Mobile Development Handbook at 32% off. Alternatively if you just want some fun browsing the site then why not enter “Windows CE” into the quick search box. The only result is “The Johns Hopkins Manual of Gynecology and Obstetrics” an ideal addition to any mobile developers toolbox!


    Finally on a related note I spotted that Doug Boling is working on an update of his Windows CE book due out in October – “Programming Windowsยฎ Embedded CE 6.0 Developer Reference“. Definitely worth adding to your wish list, even if you are primarily a managed code developer as it is important to know your way around the underlying OS.

  • Guid.NewGuid Performance

    Joรฃo Paulo was investigating Guid performance when used as identifiers in a SQL Compact database and discovered that the performance of Guid.NewGuid() left a lot to be desired. The reason for this is that the function uses lowest-common-denominator support, using a random number generator and setting a couple of specific bits to conform to guid standards. Another method I’ve been recommending for some time is to use the native CoCreateGuid() function – see http://www.peterfoot.net/NeedAGUIDInAHurry.aspx. This method is supported in all devices running Windows Mobile 2003 and above, and in Windows CE 4.x. I’ve been using it in the InTheHand.Guid2 class in Mobile In The Hand (Will be renamed to GuidHelper in the next version). I did some tests creating 100,000 guids in a row with both methods. Guid.NewGuid() took 139 seconds, and GuidHelper.NewGuid() took a mere 9 seconds. As you can see that is quite a significant difference.

  • Motorola Game Developer Challenge

    Fancy yourself as a mobile game developer and want to win loads of Motorola kit? If so the Motorola Developer Network (MOTODEV) have a game development contest for you! There are categories for both Java and Windows Mobile games, for Windows Mobile you could choose to write in native or managed code. It would be cool for the winning game to be written with the Compact Framework of course. The deadline is the 10th of August, full details are available here:-


    http://developer.motorola.com/eventstraining/gamechallenge/

  • Microsoft Mobile Development Handbook at DevDays 2007

    Rob Miles, a fellow MVP who wrote one of the chapters for our book has grabbed a copy at DevDays in Amsterdam, you can see a picture of him proudly clutching the book in his latest blog post. In case you need any further encouragement to purchase the book beyond the 600+ pages of technical stuff, you’ll notice from Rob’s picture that carrying the book is also great for attracting a posse of female admirers ๐Ÿ™‚


    I travelled home yesterday to pick up my first copy of the book, it’s such a great feeling seeing the finished book after all this time. This was actually the first opportunity I got to read Rob’s chapter properly. As a guru of graphics and games development it’s no surprise that Rob does a great job of explaining Direct 3D Mobile.

  • Windows Mobile Standard Landscape Shortcut Keys

    On a traditional Standard (nee Smartphone) device the start-menu items are arranged into a 3×3 grid, you can navigate these quickly using the numeric keypad. On a landscape device the items are arranged in a 4×2 grid so this is impractical. Instead the QWERTY keys are used, or to be exact:-













    Q W E R
    A S D F

    Another helpful feature which was introduced in one of the AKU updates to Windows Mobile 5.0 was a scrollbar so that scrolling off of the current page of menu items would advance to the next or previous screen of items (Equivalent to pressing soft-key “More” or Back button). The scrollbar give you a visual indication of where you are within the menu items which typically span 5 screens in landscape orientation.


    One part of the shell which has not received the same attention is the Settings screens. Unlike the Start Menu there is no scrollbar, you must advance to the next screen using the last list item (this is not offered as a soft-key item). This means that in landscape orientation only 6 settings items fit on a page. A few changes here would allow more items per screen and consistency with the start menu behaviour. On devices with a built in scroller such as the HTC S620, T-Mobile Dash etc you could quickly scroll through all the configuration items.


    Another place where this behaviour is not followed is the Pictures & Video application. Here the items are again arranged in a 4×2 grid on a landscape device however the key assignments are really wacky:-













    1 2 3  
    4 5 6  

    You can see that the application is hard-coded to use the numerical keys and so there isn’t a shortcut to select the righthand column.


    These help to illustrate another area where developing for multiple screen sizes and layouts can introduce complications. You should try to follow best practices to offer appropriate shortcut keys in your application, just be aware that even Microsoft have missed some of these issues in the platform itself.

  • Practical .NET 2.0 Networking Projects

    Fellow MVP Wei-Meng Lee has finished a book on building applications with a range of networking technologies using .NET, both on the desktop and on devices. This covers the fundamentals of Sockets and Serial programming and contains a number of interesting projects incorporating webcams, fingerprint readers, RFID and GPS receivers.


    The section on Infrared programming shows how to use the System.Net.Irda assembly in the Compact Framework and goes on to show how you can use exactly the same techniques on the desktop using the 32feet.NET library.


    So far it’s been a fun read and I’m looking forward to trying out some of the projects just as soon as I find my fingerprint reader!

  • Waiting for a Process

    There have been numerous occasions where I’ve needed to write code to launch another process and wait for it to complete, usually taking some action based on the exit code. Therefore I’ve got a handy helper method to do this. It has changed a few times and is made much simpler in .NETCF v2.0 by taking advantage of the Process class. Most recently I used the code in one of the book chapters to show automatic installation of the Microsoft Message Queue (MSMQ) components onto a Windows Mobile device. The method is named ShellWait, as the name implies it launches a process and waits, the return value is the exit code from the process. If the application doesn’t exist it returns -1 immediately.


    [C#]


    //helper function to launch a process and wait for the result code
    private static int ShellWait(string app, string args)
    {
       if (!File.Exists(app))
       {
          return -1;
       }



       Process p = Process.Start(app, args);
       p.WaitForExit();



       return p.ExitCode;
    }


     


    [VB]


    Private Shared Function ShellWait(ByVal app As String, ByVal args As String) As Integer
       If Not File.Exists(app) Then
          Return -1
       End If

       Dim p As Process = Process.Start(app, args)
       p.WaitForExit()

       Return p.ExitCode
    End Function