How To Create a shortcut to your PocketPC application
Previous Topic  Next Topic 

Problem:        How To Create a shortcut to your PocketPC application


Updated: Starting with Satellite Forms 7.1, when you compile your PocketPC application and include an icon for it so that an EXE application is generated, MobileApp Designer will automatically create an application shortcut .Lnk file for you, and place it in the AppPkg folder.  See the Satellite Forms 7.1 manual for more information.  The information below for manually creating shortcut files is retained for Satellite Forms 7.0 and earlier.


Solution:        This article explains how to programmatically create a shortcut to your application on the PocketPC, without using an installer.  The shortcut appears in the Programs menu on the PocketPC.


A. Background Information


When you install your application to a PocketPC, you usually want to have a shortcut to your application appear in the programs screen on the PPC.  This makes it easier for the user to start your application, by tapping on Start | Programs and then on your icon.  The shortcut takes care of launching your app, wherever it happens to be located (eg. in \My Documents\YourApp or \Program Files\YourApp).


How do you create this shortcut?  Usually, this task has been carried out by using an application installer to install your app to the PPC.  The

installer takes care of copying your application files to a specified folder on the PPC, and creating a shortcut to your app in the Programs screen. Examples of some software tools used to create PocketPC app installers include the freeware tools EzSetup, Pocket PC Installation Creator, PocketSetupCreator, and NSIS, as well as commercial tools like InstallShield, e-PocketSetup, Spb AirSetup, etc.


Users can also create shortcuts manually.  However, this is something you would generally want to take care of programmatically, instead of expecting the user to carry out this task manually.  Asking the user to create a shortcut manually does not make for a good user experience.


There is another way to create this shortcut for your user automatically, without using an installer.  For some developers, this task of creating the shortcut may have been the only reason that they used an installer, as they could carry out the rest of the app installation tasks using the CeRDKInst tool included with Satellite Forms.  Using this new approach, the shortcut file is created manually on the PC, and that shortcut file is sent to the PocketPC along with all of the other application files, using the CeRDKInst tool.  No PocketPC application installer is required.  This may be the preferred approach for corporate/enterprise deployments, where other features of an installer (eg. display of a license agreement and readme file) are not needed.



B. Creating the Shortcut on the Desktop PC


The key to understanding this approach is recognizing that the shortcut you see in the PPC programs folder is actually just a file with certain

properties, placed in a certain location on the PocketPC.  That file can be created on the desktop PC using any standard text editor, then copied to the right location on the PocketPC.


The shortcut file should be named as you want it displayed in the programs folder, with a .lnk file suffix.  For example, if your app is called

SuperDuperApp.exe, but you would like it to be listed in the programs folder as "Super Duper", you would create the file "Super Duper.lnk".  The name of the shortcut does not have to match the name of your application EXE file.


NOTE: Windows treats files with the .lnk suffix in a special manner, and considers them to be desktop shortcut files.  This means it may be difficult for you to work with the file using Windows Explorer, as it does not treat the file like a regular text file.  We find that opening your text editor, and then loading the shortcut .lnk file from within your text editor is easier than trying to work with the file in Windows Explorer.



The .lnk file itself is just a regular text file, containing the following text:


nn#"\Path\To\Your App.exe"


nn is a decimal number equal to the length of the exe file path string, including the starting and ending quote chars


# is a literal # character


"\Path\To\Your App.exe" is the path to your application EXE file



So, let's use the example of creating a shortcut to the \My Documents\SuperDuperApp\SuperDuperApp.exe app, using the shortcut name

"Super Duper".  Create a text file named "Super Duper.lnk" which includes this single line of text:


47#"\My Documents\SuperDuperApp\SuperDuperApp.exe"


Remember that 47 is the length of the "\My Documents\SuperDuperApp\SuperDuperApp.exe" path string.  You now have a valid shortcut file for your application, and just need to place it in the right location on the PocketPC.



C. Placing the Shortcut file on the PocketPC


Now that you have created the shortcut .lnk file on the PC, all you need to do to make that shortcut visible on the PocketPC is to copy it to the correct folder on the PPC.  The correct folder to place the shortcut is the "\Windows\Start Menu\Programs" folder.  This is the folder that is displayed when the user taps on Start | Programs on the PPC.  Simply copy the .lnk file into the "\Windows\Start Menu\Programs" folder, and the PocketPC will automatically find the icon for your application based on the path in the .LNK file.  It will display your app icon, with the name of the lnk file. In our example above, the icon shown in the Programs screen would be Super Duper and it would show the icon contained within the "\My Documents\SuperDuperApp\SuperDuperApp.exe" file.  Tapping on the Super Duper icon will start the application.


That is all there is to it!



D. A sample CeRDKInst install config file that includes a shortcut


The CeRDKInst utility included with Satellite Forms is used to install a list of files to the PocketPC.  Using the new "bundled runtime engine"

approach that is now available with Satellite Forms 7 using PDB databases, the CeRDKInst tool can be used to install your application and runtime engine together.  You can have CeRDKInst install the shortcut file you created above also, for a complete PocketPC installation solution.


The documentation for the CeRDKInst tool is included in the main Satellite Forms help file, under the topic Deploying Your Application | Working with the Pocket PC install utility.  The sample below shows a complete install ini file for an application, runtime engine, and shortcut file:


;Super Duper App config file for CeRDKInst

;

;Installer Section

[Installer]

EngWinTitle=Super Duper App Installer

;

;Files0 Section - app files and SF runtime

;installed to \Program Files\SuperDuperApp folder

[Files0]

DevDir=\Program Files\SuperDuperApp

Sync=FALSE

File0=..\PDAFiles\SuperDuperApp.PDA

File1=..\PDAFiles\SuperDuperApp.EXE

File2=..\PDAFiles\ESDAP0100_SDITEMS.PDB

File3=..\PDAFiles\ESDAP0100_SDSITES.PDB

File4=..\PDAFiles\ESDAP0100_SDLOOKUP.PDB

File5=..\PDAFiles\SatForms70.EXE

File6=..\PDAFiles\DvSddi_PPCPDB.DLL

;

;Files1 Section - shortcut file for SuperDuperApp

;installed to \Windows\Start Menu\Programs

[Files1]

DevDir=\Windows\Start Menu\Programs

Sync=FALSE

File0=..\PDAFiles\Super Duper.lnk




Keywords:      PocketPC, install, CERDKInst, shortcut, Windows Mobile, setup, installer, deployment


KB ID: 10045 

Updated: 2007-12-03


Satellite Forms KnowledgeBase Online

Satellite Forms Website Home