# Friday, August 10, 2007

Skydriving

Windows Live Folders is now Windows Live Skydrive and the beta has been extended to locales outside the US. The service provides a free 500mb of online storage for you to use however you want. Beyond the new look and feel and new name there is one great addition - a drag and drop upload tool which makes it much easier to upload multiple files. Previously you had to browse for files individually and upload in batches of 5. This is a great addition to the other Live services and gives you somewhere handy to store your own files online, as well as share public files with others.

#    |
# Monday, July 30, 2007
# Friday, July 27, 2007

Multiline Button

On the newsgroup somebody asked how to have multiple lines of text on a .NETCF Button control. The native control supports this but the appropriate style is not set by default. The following code snippet shows how to enable this:-

private const int BS_MULTILINE = 0x00002000;
private const int GWL_STYLE = -16;

[System.Runtime.InteropServices.DllImport("coredll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);

[System.Runtime.InteropServices.DllImport("coredll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

public static void MakeButtonMultiline(Button b)
{
    IntPtr hwnd = b.Handle;
    int currentStyle = GetWindowLong(hwnd, GWL_STYLE);
    int newStyle = SetWindowLong(hwnd, GWL_STYLE, currentStyle | BS_MULTILINE);
}

The usage is simple, just pass the specific Button control to MakeButtonMultiline:-

MakeButtonMultiline(button1);

Here is what the amended button looks like on the left (default appearance on the right)

The designer fully supports entering multiple lines for the Button Text property, just click the dropdown at the end of the field and it will pop up a window into which you can add linebreaks with your text.

#    |
# Wednesday, July 25, 2007

More POOM Anomalies

Every version of POOM (Pocket Outlook Object Model) brings great improvements, however there are always a few things which just have you screaming "Why!". One of those examples is the implementation of IItem::Edit. This method is used to open an item in edit mode, and is implemented on Windows Mobile 5.0 and above, with the exception of Appointments on Smartphone (Standard) devices. This makes no sense because otherwise the Appointment item follows the same pattern as the other item types. A dialog is implemented on the Smartphone/Standard platform and this has a perfectly usable edit screen - why this wasn't implemented in the API beggars belief. Below is a table of supported configurations for the various display methods:-

Method WM 5.0 Pocket PC WM 5.0 Smartphone WM 6 Professional WM 6 Standard
IAppointment::Display() Yes No Yes No
IContact::Display() Yes No Yes No
ITask::Display() Yes No Yes No
IItem::Display() (Appointment) Yes Yes Yes Yes
IItem::Display() (Contact) Yes Yes Yes Yes
IItem::Display() (Task) Yes Yes Yes Yes
IItem::Edit() (Appointment) Yes No Yes No
IItem::Edit() (Contact) Yes Yes Yes Yes
IItem::Edit() (Task) Yes No* Yes Yes

 

*WM5.0 Smartphone Tasks application doesn't support editing

#    |
# Tuesday, July 24, 2007

More Facebook Progress

I'm now a member of the CodePlex workspace for the Facebook Developer Toolkit. I've been working on porting across my modifications into the codebase. The .NETCF v2.0 version uses a project called Facebook.Compact but refers to the existing source files from the desktop project. Then some conditional compilation is used to hide a few unsupported features from .NETCF and implement some workarounds for missing functionality. This will be a familiar technique if you've been to Daniel's sessions (or read his blog posts on the subject). It's not quite working yet since my code made use of a couple of my own libraries for speed, so I'll need to implement a few of the features within those in the Facebook.Compact project.

#    |
# Friday, July 20, 2007

Facebook API and the Compact Framework

The Facebook API allows third-party web and desktop applications to interact with Facebook features. There is an excellent shared-source library for .NET to wrap the Facebook calls but currently it only supports the full framework. I did some work converting this source to compile and run on .NETCF v2.0. There are some example screens here of the login process, and pulling back information about our book group.

   

Since the login screen uses the same page as the desktop it's not a great fit on a Pocket PC screen, so that's an area for improvement.

#    |
# Tuesday, July 17, 2007

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)

#    |
# Friday, July 13, 2007

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.

#    |
# Thursday, July 12, 2007

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

#    |
# Friday, July 06, 2007

.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.

#    |
# Monday, June 25, 2007

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.

#    |
# Tuesday, June 19, 2007

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/

#    |
# Wednesday, June 13, 2007

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.

#    |
# Monday, June 04, 2007

Windows Mobile Standard Landscape Shortcut Keys

On a traditional Standard (nee Smartphone) device the start-menu items are arranged into a 3x3 grid, you can navigate these quickly using the numeric keypad. On a landscape device the items are arranged in a 4x2 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 4x2 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.

#    |