Solved

Difference Between Application Reference and Shortcut

Posted on 2007-11-24
3
3,333 Views
Last Modified: 2008-02-01
I have a VB.NET app using one click deployment. Since it will not create a desktop shortcut I got the bright idea to create one on program startup. The problem is the shortcut I create doesn’t do the check for updates that the one created in the start menu does.

I see that the one automatically created is of type “Application Reference” instead of a “Shortcut”. The “Application Reference” has a General and a Summary tab. The shortcut has a General, Shortcut and Compatibility tab.

Two questions:

1)      What is an “Application Reference” and how does it differ from a shortcut?
2)      How can I make the shortcut check for downloads?

I have tried goggling, but application and reference are not words conducive to search engines.

Thanks
Randy Miller
0
Comment
Question by:randymiller
  • 2
3 Comments
 
LVL 3

Expert Comment

by:ScottParker
ID: 20344357
In the Load routine of your main form put this code...
        Try
            copyShortcut("folderStartMenuShortcutIsIn", "NameOfProgram.appref-ms")
            If System.Deployment.Application.ApplicationDeployment.CurrentDeployment.IsFirstRun Then
                copyShortcut("folderStartMenuShortcutIsIn", "NameOfProgram.appref-ms")
            End If
        Catch ex As Deployment.Application.InvalidDeploymentException
            'this will always occur in debug mode. Also if user tries to run from the actual EXE
            MessageBox.Show("Please run this application from the shortcut in the Start Menu to get the automatic update feature working." & vbCrLf & vbCrLf & "You can create a desktop shortcut from that particular shortcut if you like.", "Alert")
           messagebox.show("Error with shortcut and InvalidDeploymentException")
            End
        Catch ex As Exception
            messagebox.show("Error with shortcut and InvalidDeploymentException")
            End
        End Try

Then add this function...
    Public Shared Sub copyShortcut(ByVal manufacturerName As String, ByVal shortcutFileName As String)
        'the easy way for VB programmers *
        Dim desktopPath As String = My.Computer.FileSystem.SpecialDirectories.Desktop + "\" + shortcutFileName
        Dim startPath As String = My.Computer.FileSystem.SpecialDirectories.Programs + "\" + manufacturerName + "\" + shortcutFileName
        Try
            System.IO.File.Copy(startPath, desktopPath, True)
        Catch e As Exception
            Throw e
        End Try
    End Sub
0
 

Author Comment

by:randymiller
ID: 20344428
Different approach, I like the idea.

Do you know what an "Applicatoin Reference" is?
0
 
LVL 3

Accepted Solution

by:
ScottParker earned 500 total points
ID: 20344467
the applciation reference is that "NameOfProgram.appref-ms" section.

The following link explains it better then I could.  (Even though its on a more advanced topic)

http://www.codeproject.com/useritems/ClickOnceLauncher.asp?df=100&forumid=308890&exp=0&select=1517755&tid=1513516
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
nmap scanner? 7 80
pdf to word 13 58
Adding proxy setting to Internet explorer 4 20
file size 9 8
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now