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.
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; [DllImport("coredll.dll")] public static extern void SHCreateShortcut( string target, string shortcut); // Create a shortcut to tmail.exe within the // windows start menu. SHCreateShortcut( @"\windows\start menu\programs\my email.lnk", @"\windows\tmail.exe");
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…