Blog

  • Open individual documents on Pocket PC

    The built in applications in Pocket PC follow a familiar model with a DocumentList screen listing files of that type, and then an “editor” screen for working with an individual document. If you launch a specific document programmatically it will open direct to that document, but when you close the app will continue to run returning to the document list. You can add the “-opendoc” argument to launch the application for that specific document and close completely once you’ve finished working with it. This allows you to more seamlessly use these applications from your own code and determine when they have completed. Using the Process class you would do:-


    Process p = Process.Start(“pword.exe”,”-opendoc “My Documentsmypocketwordfile.pwd”);


    This argument is supported by Notes, Pocket Word, Pocket Excel and Pocket Streets

  • Bluetooth Remote Control

    Mike Hall posted a link on his blog to a channel9 interview with Anil Dhawan from the Windows Mobile team discussing Bluetooth programming, which I recommend you check out. Anil gave a demo of a native code application to remote control PowerPoint on a desktop PC. This inspired me to put some finishing touches to a test application I built for the Bluetooth .NETCF library – It is by no means finished but it works (with the wind blowing in the right direction!).


    There are two components, on the Smartphone an application which you first select Search from the menu and it will do a lookup of local discoverable devices, then select one and select the Connect menu option. Once connected any d-pad or number keys are captured and sent over bluetooth. As I said it was an unfinished project, key items missing are:-



    • Store desktop address in the registry so we only have to search once

    • More intuitive interface 🙂

    • Support for key mapping – map the device keys to application specific commands e.g. for media player etc

    On the desktop a simple listener which listens on a custom service, incoming data is received as keycodes which are broadcast on the system using the SendKeys.Send method.


    On an unrelated note, thanks to Sergey Bogdanov who has contributed an implementation of the SendKeys class to be included in the upcoming SDF v1.3 release.


    With the listener application running and the Smartphone client connected you can automate (within reason) whatever app has the focus. It works great for Powerpoint browsing between slides using the d-pad on the phone. The usual disclaimer applies – this works only with the Microsoft Bluetooth stack on both device and desktop, I tested with an Orange SPV C500.


    The two projects are available to download here.

  • No touch deployment with Pocket PC or “How I cancelled my dental appointment with Dr Johnson”

    Earlier today I posted a link from the Windows Mobile Team blog on Pocket PC Thoughts on an article being produced to describe rolling out mobile devices to your enterprise. Here is some useful additional material with a more technical twist which didn’t seem appropriate to mix in with it.


    This applies only to deploying Pocket PC devices in the field, and works easiest if you are rolling out a set of matching device models. The following sections are some techniques which have saved me time when deploying devices:-



    • When you first startup a Pocket PC device you are greeted by a Welcome Wizard. This is a perfectly legitimate starting point for a consumer who has just unpacked and charged their device, but is a real pain if you want to automatically deploy your software onto multiple devices.  To dismiss this wizard from appearing simply place an empty file called “welcome.not” in the root of a Storage Card.
    • No more rearranging dental appointments Great! well not quite, because this introduces two new issues – among the introductory material in the Wizard are two very important steps – Screen calibration and setting the Timezone. Both of these can be applied automatically by writing entries into the Registry or calling the appropriate APIs:-


    • Timezone is written as a binary array here:-



    [HKEY_LOCAL_MACHINETime] “TimeZoneInformation”



    • The format of this is documented in the SDK – it’s a TIME_ZONE_INFORMATION structure. Assuming your batch of devices are all deployed to the same timezone you can copy the value from an existing device, or if you set the value on first run of your managed application you can make use of the DateTimeEx.SetTimeZoneInformation method in the SDF

     



    • Screen calibration is a little more interesting, as it will depend on the hardware. So although you can copy values from an existing device its probably better to run the screen calibration on the first run of your application. If you choose the “dangerous” route you’ll find the calibration settings in the string value here:-



    [HKEY_LOCAL_MACHINEHARDWAREDEVICEMAPTOUCH] “CalibrationData”



    • Kicking off the standard screen calibration applet from your code is very easy – just P/Invoke TouchCalibrate which can be defined as



    [DllImport(“coredll.dll”)]
    private static extern bool TouchCalibrate();



    • This will launch the standard calibration screen and require the user to tap the centre and four points around the screen. It will return true on success and false if if fails.

    For all of this to be automatic you will need an autorun.exe file located a folder matching the processor identifier of the device, so for any ARM based Pocket PC this would be 2577 on the storage card. While it is possible to write this application in managed code if your device has .NETCF in ROM, if you are catering for a range of devices you should write this file in native code. You can read more about this technique here and here.


    Following this I am currently testing Spb Clone which allows you to create a clone image from a single unit and install it onto multiple devices, this supports either a self extracting exe installer or an autorun approach. I will post back a mini-review once I’ve done some more testing with it.

  • Patterns & Practices Survey

    Announced on Jono’s blog the Patterns & Practices team are looking at what guidance they can provide for device development. They have now setup a formal online survey to capture your wishes and needs, so I recommend you stop by and add your thoughts:-


    Fill in the survey


    Personally I’d like to see some kind of Power Management application block and accompanying guidelines produced, along with the obvious choice of a port of the Smart Client Offline block.

  • Upcoming .NETCF Chat

    Tomorrow the .NETCF MVPs will be hosting a developer chat at MSDN. Start time is 10am PST (6pm GMT). As usual any questions related to .NETCF, Smart Device Development or OpenNETCF are welcome. Full details along with other upcoming chats on a whole raft of topics can be found at:-


    http://msdn.microsoft.com/chats


     

  • Bluetooth Library (February Edition)

    Not a huge amount of change since last months release but I just wanted to post the latest update. The download includes the same Chat application samples along with the complete solution for the library itself.


    Downloads


    The main changes in this release are:-



    • BluetoothRadio class which handles the radio state on a single or multiple radio device. Multiple radios are only supported on XP, Windows CE supports a single radio device.
    • BluetoothSecurity class which has a couple of methods to automate the pairing (bonding) process between devices. Using SetPin and RevokePin you can specify the PIN to use with a particular remote device. Using PairRequest you can force the device to intiate a connection and bond with the remote device with the specified PIN code. Currently the BluetoothSecurity class is built for Windows CE only, in a future update this functionality will be extended to run on the desktop too.
    • General housekeeping – P/Invokes have been moved into a single NativeMethods class and a few new ones added, though not all are used by the library yet.

    Online documentation for this build can be browsed here.

  • Potted history (and glimpse into the future) of the .NET Compact Framework

    Mike Zintel has posted a description of how the .NET Compact Framework got to where it is today, and where the team are headed in v2.0 and beyond.


    Key lessons learned by the team were in performance, interop and a few bloopers like the infamous DateTimePicker – the control which should never have been left out. The good news is that all these areas are receiving attention for v2.0.


    A focus for v3.0 will be managing transient networks – being able to seamlessly use a connection as and when available, based on emerging WS-* standards. We will see some improvements in this area before v3.0 as the Windows Mobile team have already announced the Notifications Broker for their next version which will support events on key system changes, however this won’t be available to other Windows CE based platforms. The problems faced are not just in choosing and activating the most appropriate connection, but handling situations where the connection is lost part way through a process, a real problem when your devices are constantly on the move, in and out of network coverage.


    My personal wishlist for v3.0 would add more support for location and context awareness, so that apps can be a little more smart to react to changes not just in network connectivity but also changing usage profiles such as sound and appearance for different locations and times.


    Once you’ve read Mike’s article you can check out some of his wonderful photographs too at http://www.zintel.net/.


     

  • More details on Generics and Reflection for .NETCF v2.0

    Nazim Lala from the .NET Compact Framework team has posted further details on the generics support in .NETCF v2.0 specifically the Reflection functionality available and how it differs from the full framework implementation.

  • Visually identify your Bluetooth stack

    Since it’s such a frequently asked question I’ve documented it here with some images which should hopefully clear up any confusion. The following screenshots show how to identify the Bluetooth stack on your Pocket Pc without writing any code or delving into the registry or system files.





















    Microsoft


    Widcomm/Broadcom

    Bluetooth Off

    Microsoft Stack (Disabled)


    Widcomm Stack (Disabled)

    Bluetooth On

    Microsoft Stack (Enabled)


    Widcomm Stack (Enabled)

    Settings (Click Icon)

    Microsoft Stack Settings



    Pocket PC 2003 Second Edition


    Microsoft Stack Settings Second Edition


    Widcomm Stack Menu


     


    Finally a quick reminder, the Bluetooth.NET library only works currently with the Microsoft stack, so if you have Widcomm/Broadcom or any other you’ll have to look at third-party APIs.

  • Mobile and Embedded Developer Conference 2005

    Announced on the Windows Mobile blog, this year will see the Mobile and Embedded developer conferences combined into one event happening in Las Vegas 9th-12th May.


    This year there will be lots of exciting content around .NETCF v2.0 and Visual Studio 2005 along with coverage of Windows Mobile and Windows CE and XP Embedded.


    Go on, write that date somewhere important 🙂