Archive for the ‘Windows Mobile Tips’ Category

Windows Mobile Tip: Word Completion settings

Thursday, April 23rd, 2009

Screenshot showing location of Input control panel applet and the Word Completion tabAnother Windows Mobile feature that is commonly undiscovered are the word completion settings. You can find these within the “Input” control panel applet, found within the Personal tab of the Settings application.

Although the labeling and precise set of options available changes with Windows Mobile version you should be able to configure the following types of word completion features:

  • Suggest words when entering text: Should Windows Mobile suggest possible ways to complete the word currently being entered via a popup list.
  • Add a space after word: Should a space be automatically inserted if the user selects a word from the word completion list.
  • Enable auto correct: Should common typing mistakes such as typing “youre” when you meant “you’re” be corrected automatically when typing a space after the word.

Enabling the Auto Correct feature is more practical for English speakers than it is for other users of other languages. The rules and auto corrections are rather hardcoded and may interfere with phrases common in other languages. You may spend more time correcting the auto corrections than it spends correcting your mistakes!

Now for the bad news… your mileage may vary with this Windows Mobile Tip. Although the word completion feature is a standard part of the operating system there are a number of “moving parts” between the keyboard and the application which could affect text input behavior. Altering these settings on your particular device may or may not alter the word completion behavior of your device, as word completion may be implemented or controlled by another part of the software stack (for example a custom Software Input Panel developed by the device’s OEM).

Tomorrow we’ll discuss how a .NET Compact Framework developer can programmatically control these word completion features on a textbox by textbox case.

Windows Mobile Tip: ActiveSync Add/Remove Programs

Friday, April 11th, 2008

Screenshot of ActiveSync main window highlighting Add/Remove Programs optionAre you aware of the Add/Remove Programs menu option within ActiveSync? When you have a PDA connected to your desktop PC you can use the dialog to install new applications onto your PDA as well as uninstall existing software.

For example when you install the .NET Compact Framework 3.5 Redistributable on your desktop PC it will register the .NET CF 3.5 CAB files with ActiveSync. This means you can install the .NET CF 3.5 on as many PDAs as you require by using the Add/Remove Programs dialog. You don’t need to re-install the redistributable package for each newly connected PDA.

Adding your own application to ActiveSync’s list

With a little bit of additional effort it is possible for application developers to register their own application CAB file(s) with ActiveSync so that they are installable via the Add/Remove Programs dialog. This provides an easy way for non technical users to install your application as they do not need to be able to manually copy a file to the PDA or select it within File Explorer. You can even get this to occur automatically when your desktop setup application runs.

The following resources will help you implement this feature:

Windows Mobile Tip: Creating shortcuts

Thursday, March 27th, 2008

Shortcuts are small files containing the location of another file, or the command line required to launch an application. They are commonly placed within the Windows Start Menu as a convenient way to access common functions of your device. By creating and organising your own shortcuts you can customise the features you have quick access to on your device.

Creating a shortcut

You can create shortcuts directly on the device by using the built in File Explorer application. In order to create a shortcut first navigate to the file you want a shortcut for and tap and hold the stylus over the file to display a context sensitive popup menu. From the menu select the “Copy” option.

Now navigate to the location where you want to place the shortcut and tap and hold the stylus over a blank area (such as after the last file in the directory listing). This displays a similar context sensitive popup menu from which you can select a “Paste Shortcut” option.

A shortcut to the file will be created. By default the newly created shortcut will have the name “Shortcut to XYZ” where XYZ was the original file name. By using the standard file rename functionality you can rename the shortcut to a more suitable name.

Uses of shortcuts

Shortcuts are used within the Windows Mobile operating system for a wide range of purposes. By placing your shortcuts into specific folders you can obtain special functionality. Some examples include:

  • \Windows\StartUp – shortcuts to applications placed in this directory will automatically be started whenever the Windows Mobile device is reset.
  • \Windows\Start Menu – shortcuts placed in this directory will appear in the Windows start menu.
  • \Windows\Start Menu\Settings – as discussed in a previous blog entry shortcuts placed in this folder will appear on the System tab of the Settings application that is accessible via the Start Menu.

Early adopters of the Pointui shell replacement for Windows Mobile devices are using similar techniques to customise the functionality of the built in menus to launch phone dialler applications etc.

Technical Details

Behind the scenes File Explorer is creating a shortcut file (probably via the SHCreateShortcut API). A shortcut is a file that has the extension *.lnk and contains details of the command line or file that the shortcut should open.

Pavel Bánský discusses in his blog the technical details on the contents of a *.lnk file. As an alternative to creating the shortcut file manually, you can also utilise an API called SHCreateShortcut as shown below:

using System.Runtime.InteropServices;
public static extern void SHCreateShortcut(
  string target,
  string shortcut);
// Create a shortcut to tmail.exe within the
// windows start menu.
  @"\windows\start menu\programs\my email.lnk",

Shortcuts can also be created as part of a CAB file installation package for your applications, as discussed in the .NET CF Deployment section of the Microsoft Visual Studio 2005 Professional Guided Tour.

Shortcuts can also have other purposes, one of these I will discuss in greater depth in a future blog posting…

Windows Mobile Tip: Creating managed control panel applets

Friday, December 14th, 2007

aaTo create a dialog that appears within the Settings application (accessible via the Windows Start menu) you could utilise the Control Panel Applet API. However this API doesn’t lend itself to writing an applet in C# or VB.NET.

As an alternative you can create a standard .NET Compact Framework Device Application. Once you have deployed your application you can place a shortcut to it within the \Windows\Start Menu\Settings folder. This will cause your application to appear within the System tab of the Settings application (as demonstrated by the “Earth” icon shown in the screenshot).

By configuring the properties of your application’s form you can get your application to appear the same way a standard control panel applet does (i.e. a title row of bold text and a 1 pixel high divider line).

When creating a settings shortcut you may need to soft reset your device to have your new option appear. One disadvantage of using this tip is the fact that you can not control which tab your application will appear on.

There is nothing stopping you from creating a shortcut to a third party application. I like moving shortcuts to system utilities such as registry editors and backup utilities into the Settings application instead of the main Programs list.

Windows Mobile Tip: Show all files within File Explorer

Thursday, November 15th, 2007

show-all-files.PNGThis is a Windows Mobile Pocket PC specific tip which takes some people a little while to discover (especially if using a Windows Mobile device isn’t part of their day to day job).

By default the File Explorer application does not show all files. As well as files specifically marked as hidden, it will hide files with a series of “special” file extensions such as *.dll.

In order to show these files you must enable the “Show All Files” option, which can be achieved by following these steps:

  1. Open the File Explorer application.
  2. Scroll down to the blank area at the bottom of a directory listing.
  3. Tap and hold the stylus on the blank space underneath the last file in the directory listing.
  4. Select “show all files” from the popup menu which appears.

The directory listing should now display all files within the folder. Unfourtantly since file extensions are not visible you may end up with multiple enteries with the same name. For example, foo.exe, foo.dll, foo.txt and foo.pdf will all be listed as “foo”.

If the icon associated with a particular file extension doesn’t help you determine the type of file, you can tap on the file. If the file is assoicated with an application it should be launched automatically. If there is no association a message box will be displayed stating “ is not a valid executable”. This message box will display the full filename (including extension) of the file.

A future blog entry will outline how developers can extend the functionality of built in applications such as File Explorer. We will develop an extension that allows us to rename the file extension of a file (i.e. change foo.log into foo.txt).

Windows Mobile Tip: Determine which versions of the .NET Compact Framework are installed

Sunday, August 12th, 2007

Windows Mobile devices can come with different versions of the .NET Compact Framework installed in ROM. End users can also install various service pack releases etc. This blog entry outlines how in customer support scenarios you can determine which version(s) are currently installed on a particular device.

The .NET Compact Framework installs a utility called cgacutil.exe onto each device. This utility is primarily designed to allow the addition or removal of assemblies from the .NET Compact Framework’s GAC (see the section titled “The GAC” within Richard Grimes’s Fusion Workshop article for further details).

The utility however also has a handy feature which enables you to determine which version(s) of the .NET Compact Framework are currently installed.

How to run cgacutil.exe
On Pocket PC or Smartphone devices you can use the File Explorer application to navigate to the \Windows directory. Within this folder you will find the cgacutil.exe application which you can launch by tapping on it. As an alternative you could use the run dialog tip I mentioned earlier by typing “cgacutil” into the run dialog.

Once cgacutil is started a popup message box will appear which will list the version numbers of currently installed version(s) of the .NET Compact Framework.

Picture of message box displayed by cgacutil application showing which versions of the .NET Compact Framework are installed

If more than one version of the .NET Compact Framework is installed, these will be listed in a comma separated list.

Comparing .NET Compact Framework version numbers to releases
To convert the version numbers reported by cgacutil into the names of the co-responding .NET Compact Framework releases you can compare them to the following table:

Release Name Version Number
1.0 RTM 1.0.2268.0
1.0 SP1 1.0.3111.0
1.0 SP2 1.0.3316.0
1.0 SP3 1.0.4292.0
2.0 RTM 2.0.5238.0
2.0 SP1 2.0.6129.0
2.0 SP2 2.0.7045.0
3.5 RTM 3.5.xxxx.0

This table contains all current versions of the .NET Compact Framework. I however have not included any BETA or CTP (Community Technology Preview) releases as these are generally found only on devices owned by developers.

The .NET Compact Framework v3.5 has not been released to manufacture (RTMed) yet. Hence the exact version number is not known at this time. The entry in the table above is only for indicative purposes only, I do not know which digits will replace the xxxx part of the version number at this stage.

Windows Mobile Tip: Peeking inside CAB files

Saturday, July 28th, 2007

CAB files are the standard installation mechanism for Windows CE powered devices. Have you wondered what files have been installed by a given piece of software? Or what registry settings may have been overwritten during installation? If so, then this tip is for you.

CAB File Formats
A Microsoft CAB file is similar in nature to a common ZIP, or TAR file. They are a form of archive which contain one or more files. The individual files within a CAB file may have been compressed to reduce the overall size of the archive.

This archive file format has been re-purposed for application installation on Windows CE devices, by specifying a file with a special name that outlines the tasks required to install a given software package. This list of tasks will typically include decompressing and copying various files onto the PDA, but may also contain instructions to configure registry settings, or install shortcuts into the start menu etc.

Over the years the precise format of these files has changed. For a while the Windows Mobile Pocket PC and Smartphone platforms had incompatible CAB file formats. This has been resolved since the Windows Mobile 5.0 release which brought about a “unified” CAB file format for both platforms.

The older style CAB files had the list of setup instructions listed in a binary formatted file. The only information I am aware of on the structure of these CAB files is some reverse engineered documentation produced by the developers of the cabextract project.

The newer style CAB files have the list of setup instructions listed in an XML file called _setup.xml. It is this particular format that I will discuss here.

Extracting the contents of CAB files
On a desktop PC there are a number of ways you can extract the individual files within a CAB file. These include:

  • expand.exe – the Microsoft File Expansion Utility is a command line application present on all Windows machines. Specifying the name of a CAB file will cause the CAB file to be extracted into the current directory.
  • explorer.exe – by default most recent versions of Windows have an explorer shell extension which enables users to browse the contents of a CAB file by simply double clicking on it (as seen in the screenshot).
  • Winzip – many third party archive utilities will associate themselves with CAB files and enable you to extract their contents.

If you extract the _setup.xml file you can confirm that it’s main element is <wap-provisioningdoc>. This is a WAP provisioning document, as documented in MSDN in the Configuration Service Provider section.

The particular subset of this file format used by typical CAB files is fairly straight forward to follow, even without referring to the documentation. The _setup.xml file will enable you to determine the proper file names for the other files within a CAB file, and more importantly where they are installed to. One thing to be aware of is the use of macro Strings such as %CE2% to cope with internationalisation within file paths.

Possible uses of this tip
During development of an application, using this tip can be handy to verify that your CAB files are installing the desired files and settings. It is also useful when you have a CAB file which you have lost the original source code to, to determine what changes are made to the device.

The information would also be of use if you are developing an application to merge individual CAB files into one combined CAB file, such as the application discussed by Chris Tacke on his blog.

Random CAB fact of the day
Did you know that CAB files transfered via ActiveSync may be altered during the transfer process? If you have a CAB file which has been authenticode signed with a certificate, ActiveSync may strip off the certificate during the transfer process if it determines the connected device does not support signed cab files. This is something to be aware of, if you notice your CAB files won’t install if you download them across the network, but will if manually transfered via ActiveSync.

Windows Mobile Tip: Context Sensitive Help

Thursday, July 19th, 2007

An image of the Windows Mobile start menu on a Windows Mobile 6 Professional DeviceDid you know that Windows Mobile applications have context sensitive help integrated into them? If so, congratulations, as I feel this is a reasonably unknown feature, even if it is right there in the Start Menu!

Within any application you can obtain context sensitive help for the current window by selecting the “Help” item from within the Windows Start Menu. Selecting this option will launch the help viewer application (peghelp.exe) and load a page specific to the current state of the application you are in.

A good place to see a demonstration of this feature is the Settings or Control Panel Applets part of the shell. As you switch between the various tabs and popup dialogs you will notice that each time you select the “Help” menu option a different help page, specific to the particular set of tasks you can achieve on the current dialog will be displayed.

An image of the Windows Mobile help viewer application on a Windows Mobile 6 Professional deviceAnother help feature of use is the search feature. Within the Windows Start Menu you will be able to find a “Programs” entry. Clicking on this will display a list of all currently installed applications. The one of interest to us is simply called “Search”.

The Search utility is most often used to search for documents, files and PIM data stored within Pocket Outlook. However it also searches help files. As an example search for “Delete” and you will get a bunch of references to help files, outlining how to delete digital certificates, delete folders, uninstall programs etc.

The Gotcha
Integrated help will not work within all third party applications. A developer of an application must write a small amount of additional support code within their application to support the feature, and since many application developers are not aware of this feature, it is of no great surprise that many applications don’t support it. When it’s not supported tapping on the “Help” menu entry within the Windows Start Menu will simply close the menu.

Windows Mobile Tip: Accessing the Run dialog

Wednesday, July 18th, 2007

Picture of Windows Mobile Pocket PC Today Screen showing the Run dialogWindows Mobile has had a run dialog similiar to the one found in desktop versions of Windows since Windows 95 for as long as I can remember. This feature is not well known however.

On the main Today screeen of a Windows Mobile powered Pocket PC (Windows Mobile Professional or Classic for those up with the current lingo) you can tap and hold down the ‘Action’ key while tapping and holding the stylus on the clock shown on the nav bar. The ‘Action’ key is usually the center of the D-Pad or Ctrl if you are using the emulator.

Picture of popup menu displayed when user taps and holds on clock When you release the ‘Action’ key a small popup menu will appear, and you can select the ‘Run’ option which will display a small dialog.

Within this dialog you can enter the path to any executable, as well as any required command line parameters.

Examples you may like to try out are as follows:

  • calc.exe
  • iexplore.exe
  • ctlpnl.exe cplmain.cpl,4,0

For more details on accessing control panel applets from the command line, like the last example demonstrates refer to the Using Control Panel article on the Pocket PC Developer Network website.

This feature can be handy during development of applications for tasks such as re-registering COM dlls, however it is rather impractical for day to day use due to the typical slowness of entering the command line and the fact that unlike on the desktop there is no history of previous commands.

As an additional tip, did you know that if you tap and hold without the ‘Action’ key being pressed a different popup menu will appear? This one allowing you to select between an analogue and digital clock being displayed on the navbar.