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

怎甘沉沦 提交于 2019-12-18 10:57:22

问题


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?


回答1:


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.




回答2:


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




回答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.




回答4:


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"




回答5:


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.




回答6:


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.




回答7:


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.




回答8:


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




回答9:


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.



来源:https://stackoverflow.com/questions/145440/deploy-a-desktop-shortcut-to-a-device-running-windows-ce-4-2-vs2005

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!