views:

5018

answers:

10

I have an application written using VS2005 in C# targeting the Compact Framework 2.0 SP2. As part of the solution, I have CAB deploy project which deploys to the device without a problem. What I can't do is create a shortcut to my application on the devices desktop.

I have spent several hours reading various bits of documentation (why is the search at the MSDN site so bad?), followed the instructions but no joy.

What I've done is:

  • Add the "Windows Folder" node to the File System
  • Created a folder underneath that named "Desktop"
  • Created a shortcut to the Applications Primary Output and placed that in the "Desktop" folder

What am I missing?

A: 

I assume that you're working with a "Smart Device CAB Project"? I don't think this project creates shortcuts in the correct manner for Windows CE 4.2. I think you can download an SDK from Microsoft that after installation will show you something like "Windows CE CAB Project" as a project option.

I think you can do this manually, though. A Windows CE shortcut is a file with a *.lnk extension, so if you want a shortcut labeled "My Application", create a text file on your PC named "My Application.lnk". The file's contents should be:

46#\Program Files\My Application\MyApplication.exe (the # should be the full path length)

or whatever full path your application has on the Windows CE device.

In your CAB project, continue with adding the "Windows" folder and then the "Desktop" folder as you were. In the Desktop folder, right-click and add the LNK file that you created. You may have to soft-reset the device in order to have the shortcut show up after installation.

MusiGenesis
I did as you suggested, but when I try to add it to the Desktop folder, VS complains: "Cannot resolve this link. This file may not be a shortcut."
Mitch Wheat
I did say "I think" a lot. Are you running Pocket PC 2003 or Windows Mobile, or are you actually running the old Windows CE 4?
MusiGenesis
+3  A: 

A Windows CE shortcut (CE of any version or flavor, including WinMo) uses a ASCII-text based file. They are in the form:

{XX}#{PATH}

Where:

  • XX = the number of the characters in the path, to include the number a # sign
  • PATH = fully qualified path to the file to run

For example:

20#\Windows\calc.exe

The other option is to use the CEShortcuts section of the INF file used to generate your CAB.

In the [DefaultInstall] section of the INF, set the CEShortcuts to a section name of your choice (something like "Shortcuts"), then add that section with your shortcut descriptor. MSDN details it here.

MSDN also has an article on creating a deployment project to generate the cab (available here), but in all honesty, the project capabilities are limited and IMO the tool just generally sucks. To this day we still use direct calls to CABWIZ (which also sucks, but it's our only choice) with hand-written INF files.

ctacke
+1  A: 

Mitch: create the LNK file as before, but give it a name like "shortcut.lnkx" (note the "x" on the end). You can then add it to the "Desktop" folder in your CAB project. Once the file is added, change the TargetName property to "shortcut.lnk" and compile. I think this will work.

MusiGenesis
A: 

Hey, Assuming that you use Windows Mobile (5.0 or 6.x) you could use that syntax to create a file as a shourtcut(*,lnk):

SHORTCUT = XX#"\Program Path..."?\Icon File Path...,-Icon Number

Where:

XX = Count of characters to be included in arguments after the Program Path to process. Program Path = Target exe file location. Icon File Path = If exe file does not contain an icon image or you want to use another, this is the location of the file containing the icon image. Icon number = Index of icon image within the file, it starts with 0.

Ex: 86#"\Storage Card\Logical Sky CEdit\cedit.exe"?\Storage Card\Logical Sky CEdit\cedit.exe,-101

I had test it, and works fine.

A: 

Can someone please post a sample Inf file for installing to the desktop? I've tried everything in the post (inf method) and nothing works.

Thanks in advance.

Coda
A: 

Maybe a little late, but just for the record, it's really simple:

http://www.innovation-hut.com/Articles/CF/Deploying%20a%20Smart%20Device%20Applications/DeployingaSmartDeviceApp.aspx

(Check Figure 6)

This is not a solution to creating a shortcut on the desktop. Thanks for the effort though.
Coda
A: 

The Simplest way is to go into the Application folder in Cab Project(setup), right click on your EXE Program(Application exe that you want to make shortcut for) and chose "Create Shortcut to" and move that file to any folder you want such as "Start Menu Folder"

Wael Dalloul
A: 

How can I add a single image file? I tried ?\path\myicon.ico and ?\path\myicon.png. It doesn't work. :-(

Dionydor
A: 

Hi everyone,

A bit late but maybe this will help somebody like me who searched for this issue, I solved the problem like this:

I added a custom folder on the root node (File System on Local Machine) and called it %CE3%. That is the shortcut for \Windows\Desktop. I added my shortcut (right click create new shortcut) and gave it a name. That's it, then I build!

When analysing the Shortcuts section in the inf generated, it looked good.

[Shortcuts] "ShortCutName",0,"MyApp.exe","%CE3%"

And when I deployed and it worked perfectly !

I'm using VS2008 and deploy on windows CE 5.0

Here is a list of shortcuts: windows CE shortcuts

cheers

Steve

Steve
A: 

Steve's answer works easily, thanks Steve

Bob
This shouyld be a comment, not an "answer" because it doesn't answer anything.
ctacke