Aller au contenu

Windows Mobile Shortcuts

Sep 16, 2009 | 42Gears Team

Shortcuts makes it easy for users to launch applications. Shortcut files have “.lnk” extension and they take up very little storage space. Shortcuts contain information about the application to launch along with any parameter information. They are really handy if predetermined values need to be passed to the application as command line parameters.

How to create a Shortcut on the device

– Run Microsoft ActiveSync on your desktop and establish connection with the PDA.
– Right-click on the ActiveSync icon on the desktop Windows taskbar and Click Explore. This will bringup a window showing contents of Mobile Device folder
– Now goto the folder where the executable resides
– Rightclick on the file (say ABC.exe) and a menu pops up. Select Create Shortcut menu item
– This will generate a shortcut (.lnk) file with the name like “Shortcut to ABC.exe”
– You can rename the shortcut to anything that you like
– Move or copy the shortcut if you want it anywhere else on the device

How shortcuts work (Tech stuff for developers)

This section describes the format of a shortcut file. Simply copy the .lnk file to the desktop and open it in your favorite text editor. I use Notepad. The content in the .lnk file will have the following format.

xx#”{APPLICATION_PATH}{OPTIONAL PARAMETERS}”

where xx is number of characters in the above text excluding xx#.

For e.g.

18#”Windowsabc.exe”

where 18 is the count of characters after pound character (#) and Windowsabc.exe is the target application.

To create a shortcut from your application use SHCreateShortcut API.

Sample Code: (Courtesy MSDN)

BOOL SHCreateShortcutExample()
{
// Create a shortcut called myAppShortcut.lnk,
// that links to the target file in \, named myApp.exe.
// Place the shortcut in the folder Windows.
return SHCreateShortcut(TEXT(« \Windows\myAppShortcut.lnk »), TEXT(« \myApp.exe »));
}

Subscribe for our free newsletter

Thank you! you are successfully subscribed.
newsletter

Exclusive News and Updates on Enterprise Mobility!

* I consent to receive newsletters via email from 42Gears and its Affiliates.
Please agree
* I have reviewed and agreed to 42Gears Privacy Policy and Terms of Use prior to subscribing and understand that I may change my preference or unsubscribe at any time.
Please agree
Please verify captcha
Please enter a valid official email