Blog

  • Win a trip to PDC in Los Angeles

    Microsoft New Zealand are running a competition to win a trip to the next Microsoft PDC event in Los Angeles. It is open to all developers living in New Zealand. All you need to do to enter is help them out with questionnaire:-

    “Targeted towards NZ developers, we want to get a better understanding and better cater our resources, events and training in the future. The survey is from now until the end of April. One lucky NZ developer will win an all expenses paid trip to the next PDC in LA.”

    Click here to complete the survey

  • Application and File Icons with Mobile In The Hand 4.0

    There are a number of scenarios in which you want to retrieve the icon associated with a particular executable or other file type. One example is when building a file browser, you might also want to extract the icon associated with your application or another. The full .NET framework contains Icon.ExtractAssociatedIcon() for this very purpose. Mobile In The Hand includes a helper function to achieve the same result from the Compact Framework. Simply use the following code:-

    1. Icon i = IconHelper.ExtractAssociatedIcon(filePath);

    filePath is the full path to any file. The icon will either be the icon associated with a particular file type or in the case of executables will be the embedded application icon (or a generic application icon if not present). The result is a regular System.Drawing.Icon type which you can draw using the Graphics class normally.

    The documentation for the IconHelper class is available in the online library. For more information about Mobile In The Hand see the product page.

  • Interesting Windows Phone News for MIX10

    There have been rumours floating around all over the web about Windows Phone future versions. Microsoft have remained tight lipped allowing various tech sites to come up with all sorts of fanciful stories. However a tantalising news snippet has appeared on Microsoft’s website for MIX10 the conference for designers and developers coming up in March in Las Vegas:-

    http://live.visitmix.com/News/Windows-Phone-at-MIX10

    It will definitely be worth keeping an eye on this event, hopefully more information will be released as the sessions and schedule are firmed up:-

    http://live.visitmix.com/Sessions#/tags/WindowsPhone

     

  • New Development Certificates

    Microsoft have now released some replacement developer certificates for Windows Mobile. See this post for details and a download link:-

    http://windowsteamblog.com/blogs/wmdev/archive/2010/01/12/new-windows-mobile-developer-certificates.aspx

  • Expired Development Certificates

    As some of you may have noticed the development certificates which are shipped with the Windows Mobile 6 SDK all expired on 31st December 2009. There have been no updates provided yet so the only official workaround is to fiddle with the date on your development PC and devices to set it before 31/12/2009. A ray of hope has been cast by moderator “Chunsheng Tang” on the MSDN forums:-

    “FYI. The issue will be addressed in the next SDK update in the near furture. Besides the workarounds mentioned in this thread, you can also temporarily change the date of the development PC and the devices backward (make sure it’s before 12/31/2009).”

  • Replacement for Type.GUID

    A question came up on the newsgroups of how to get the Guid assigned to a Type via a GuidAttribute. Typically this will be defined when creating a manged Class/Interface to match a COM exposed CoClass/Interface. The desktop exposes a GUID property of the Type class. The workaround for the Compact Framework is fairly straight-forward and for convenience I have posted an amendment to my solution below in the form of an Extension method. This means that from your code you can achieve the desired result with Type.GetGUID() – which is as near as can be to the desktop syntax:-

    1. /// <summary>
    2. /// Extension method to get the GUID associated with the Type.
    3. /// </summary>
    4. /// <param name=”t”>the Type.</param>
    5. /// <returns>The GUID associated with the Type.</returns>
    6. public static Guid GetGUID(this Type t)
    7. {
    8.     Guid typeGuid = Guid.Empty;
    9.     object[] attributes = t.GetCustomAttributes(false);
    10.     foreach (object o in attributes)
    11.     {
    12.         if (o is GuidAttribute)
    13.         {
    14.             //has GuidAttribute – get the value
    15.             GuidAttribute ga = (GuidAttribute)o;
    16.             typeGuid = new Guid(ga.Value);
    17.         }
    18.     }
    19.  
    20.     return typeGuid;
    21. }

     

    I have switched to using Live Writer for blog posts (no idea why I didn’t try it before) and it has much better support for code formatting especially with the “Paste as VS Code” plug-in.

  • Happy New Year

    My last post of 2009 is just a quick message to send all the readers of this blog best wishes for 2010 and to thank you for your support this year. 2009 was a very busy year and not just on the work front as this year I got married and moved half way across the world with my amazing wife. In hind-sight trying to organise both at the same time was very ambitious but it all worked out great and we’ve had some wonderful adventures! I can only hope that 2010 will be as exciting and rewarding.

  • Email Configuration with Mobile In The Hand 4.0

    One of the new items introduced in version 4.0 is a wrapper for the Email configuration provider. This provides a one-stop-shop to access and modify email account settings. This is used for all email account types except for Exchange synchronisation. Each account is identified by a unique Guid so to work with account settings you’ll need to know this. This is exposed through a property of the EmailAccount object, for example the following code loops through all available EmailAccounts for which there is a unique ID (excludes the Exchange account).

    foreach       (EmailAccount ea in os.EmailAccounts)

    {

       if (ea.Properties[AccountProperty.UniqueStoreID] != null)

     

    The UniqueStoreID is a Guid property and so can be cast to the Guid type (the Properties collection returns items of type object because it caters for all different types of properties).

    Guid g = (Guid)ea.Properties[AccountProperty.UniqueStoreID];

    The EmailAccountConfiguration class is located in InTheHand.WindowsMobile.Configuration.dll in the InTheHand.WindowsMobile.Configuration.Providers namespace. A new instance is created by passing the Guid into the constructor:-

    InTheHand.WindowsMobile.Configuration.Providers.EmailAccountConfiguration eac = new InTheHand.WindowsMobile.Configuration.Providers.EmailAccountConfiguration(g);

    Once created you have access to a number of properties which describe the account, you can change any of these and push your changes by calling the Update() method. Properties available include the incoming and outgoing servers, the ServiceType – either “POP3” or “IMAP4”, DownloadDays (number of past days to download) and many more. The documentation for the class is available in the online library. For more information about Mobile In The Hand see the product page.

     

  • Internet Connection Sharing with Mobile In The Hand 4.0

    In Mobile In The Hand 4.0 all the Windows Mobile networking features are found in the InTheHand.WindowsMobile.Net assembly. This contains support for Connection Manager, Internet Sharing and Wireless Manager. This post will look at the Internet Sharing classes. Internet Sharing was introduced in Windows Mobile 5.0 AKU 3 but is generally associated with Windows Mobile 6. You can share an internet connection over a USB connection or over Bluetooth using the PAN (Personal Area Network) profile. To enable or disable a sharing session from your code you need only call a single method which looks like this:-

    InTheHand.WindowsMobile.Net.InternetSharing.Enable(InTheHand.WindowsMobile.Net.SharingConnection.Bluetooth,”O2″)

    The first argument is a member of the SharingConnection enumeration which contains values for Bluetooth and Usb. The second argument is the name of the internet connection to use – this is the name of the GPRS connection which will be dialled. A simple Disable method exists to shut down the sharing connection:-

    InTheHand.WindowsMobile.Net.InternetSharing.Disable()

    You must remember to disable the connection once you have finished using it.

    A full online library of class documentation for all this and more is available. For more information about Mobile In The Hand see the product page.

  • More on “My” Functionality in Mobile In The Hand 4.0

    In the last post on “My” functionality I showed you how to get started adding the My Extensions to your project. In this post I have assembled a detailed tree of all the “My” functionality added in Mobile In The Hand 4.0.

    • My
      • Application
        • Culture
        • Info
          • AssemblyName
          • CompanyName
          • Copyright
          • Description
          • DirectoryPath
          • ProductName
          • Title
          • Trademark
          • Version
        • UICulture
      • Computer
        • Audio
          • Play()
          • PlaySystemSound()
          • Stop()
        • Clipboard
          • Clear()
          • GetData()
          • GetDataObject()
          • GetImage()
          • GetText()
          • SetData()
          • SetDataObject()
          • SetImage()
          • SetText()
        • Clock
          • GmtTime
          • LocalTime
          • TickCount
        • FileSystem
          • CombinePath()
          • CopyDirectory()
          • CopyFile()
          • CreateDirectory()
          • DeleteDirectory()
          • DeleteFile()
          • Drives
          • FileExists()
          • GetDirectories()
          • GetDirectoryInfo()
          • GetDriveInfo()
          • GetFileInfo()
          • GetFiles()
          • GetName()
          • GetParentPath()
          • GetTempFileName()
          • MoveDirectory()
          • MoveFile()
          • OpenTextFileReader()
          • OpenTextFileWriter()
          • ReadAllBytes()
          • ReadAllText()
          • RenameDirectory()
          • RenameFile()
          • SpecialDirectories
            • CurrentUserApplicationData
            • MyDocuments
            • ProgramFiles
            • Programs
            • Temp
          • WriteAllBytes()
          • WriteAllText()
        • Info
          • AvailablePhysicalMemory
          • AvailableVirtualMemory
          • InstalledUICulture
          • OSPlatform
          • OSVersion
          • TotalPhysicalMemory
          • TotalVirtualMemory
        • Keyboard
          • SendKeys()
        • Name
        • Ports
          • OpenSerialPort()
          • SerialPortNames
        • Registry
          • ClassesRoot
          • CurrentUser
          • GetValue()
          • LocalMachine
          • SetValue()
        • Screen
      • User
        • Name

    A full online library of class documentation for all this and more is available. For more information about Mobile In The Hand see the product page.