Deploy a Desktop Shortcut to a Device running Windows CE 4.2 (VS2005)
Asked Answered
P

9

9

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?

Praseodymium answered 28/9, 2008 at 7:56 Comment(0)
A
7

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.

Allfired answered 28/9, 2008 at 14:45 Comment(0)
A
9

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

Aport answered 11/8, 2010 at 10:7 Comment(0)
A
7

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.

Allfired answered 28/9, 2008 at 14:45 Comment(0)
P
3

I had this same problem and found a simple solution, if anyone still needs this.

Instead of adding a windows special folder, just add a custom folder named Windows, then a folder within it named Desktop, and put the shortcut there.

This worked for me.

Patch answered 30/10, 2012 at 17:53 Comment(0)
S
2

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"

Selflove answered 1/7, 2009 at 9:55 Comment(1)
I don't see an application folder in my cab projectTissue
S
1

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.

Sociopath answered 28/9, 2008 at 15:29 Comment(0)
C
1

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.

Camphene answered 18/12, 2008 at 12:56 Comment(0)
M
1

1.Copy the file.

2.Go to desktop (or wherever you want to create the shortcut).

3.Right click on an empty space, click Paste Shortcut.

That's it.

Marchioness answered 1/9, 2015 at 7:20 Comment(0)
R
1

Actually, this is pretty simple ! (Using VS 2008 and Smart Device CAB project)

1- In the solution explorer on VS, Go to your CAB project and right-click on it.

2- Go to View -> File System

3- Here, on the left column, right-click and "Add Special Folder"

4- Select Start Menu Folder for the shortcut folder

5- Go to the Application Folder just above

6- On the right column, right click on the Primary output and select "Create shortcut to bla bla bla"

7- Then you just have to move it to the start menu folder on the left and rename the File :)

OPTIONAL: You can even add fonts to the device using "Fonts folder" in the "Add Special Folder" menu !

Cheers

Revkah answered 11/4, 2016 at 8:47 Comment(1)
This got me the final steps.Stereochromy
S
0

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.

Sociopath answered 28/9, 2008 at 8:23 Comment(2)
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."Praseodymium
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?Sociopath

© 2022 - 2024 — McMap. All rights reserved.