locked
Create Disposable App that Deploys Desktop Shortcut with Icon Only RRS feed

  • Question

  • We are launching a website soon. We want to deploy a desktop shortcut to our area offices. These offices are not connected to our network. Therefore we are looking to create a disposable application that can run once simply to create the desktop shortcut with the icon we've created.

    We are using Visual Basic Express Edition. What are some suggestions/recommendations for how we should go about this?
    Friday, March 13, 2009 8:05 PM

Answers

  • I provided the offices with 2 options. The first option was to download the ico file from a website and save it to their hard drive, then create the shortcut on each PC's desktop tying that icon to the shortcut. I provided a guide for those that needed instructions on how to do it. The second option was to download a Windows application that uses the icon as it's desktop icon and is used only to launch the website to the PC's default web browser. It's a ClickOnce solutions and checks for updates each time it starts.
    Thursday, May 14, 2009 5:40 PM

All replies

  • What I've decided to do is to create a ClickOnce application that, when launched, will launch the default web browser to the specified web address. This application will have a desktop icon and will only display a brief message explaining that the website is loading. Once the code runs to launch the web page, the application exits. So it is very unlikely that the application will be open long enough for someone to see the "loading website" message.

    I am still open to any other suggestions.

    Thanks.
    Monday, March 16, 2009 3:47 PM
  • Generally, ClickOnce Deployment doesn’t create application shortcuts as you would expect.
    However, if your project targets .Net Framework 3.5, and .Net Framework 3.5 SP1 and they have been installed, you can create a desktop shortcut for your application via ClickOnce deployment.
    Go to Project menu -> Properties… -> Publish tab -> Options… button-> Manifests entry -> Check the "Create desktop shortcut" option

    If your project targets .Net Framework versions, or you want to create shortcut at any location, you can use the Windows Scripting Host (WSH) runtime library (IWshRuntimeLibrary) to create  a shortcut programmatically as you’d expect.
    Firstly, Add Reference -> COM tab -> Choose “Windows Script Host Object Model” and add it to your project
    Code sample: Create application shortcut on the Startup folder

    Imports IWshRuntimeLibrary 
    Public Class Form1 
     
        Dim StartupFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.Startup) 
        Dim shortcutFilePath As String = StartupFolder & "\MyShortcut.lnk" 
     
        ' Add/create the shortcut to the Startup folder 
        Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button1.Click 
            Dim WshShell As WshShellClass = New WshShellClass 
            Dim MyShortcut As IWshRuntimeLibrary.IWshShortcut 
            ' The shortcut will be created in the Startup folder 
            MyShortcut = CType(WshShell.CreateShortcut(shortcutFilePath), IWshRuntimeLibrary.IWshShortcut) 
            'Specify target file full path 
            MyShortcut.TargetPath = Application.StartupPath & "\YourAppName.exe" 
            ' e.g.  MyShortcut.TargetPath = "C:\WINDOWS\system32\calc.exe" 
            MyShortcut.Save() 
        End Sub 
     
        'Remove the shortcut from the Startup folder 
        Private Sub Button2_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button2.Click 
            If IO.File.Exists(shortcutFilePath) Then 
                IO.File.Delete(shortcutFilePath) 
            End If 
        End Sub 
    End Class 
     


    You can use  Process.Start("D:\Program Files\Internet Explorer\iexplore.exe", "www.msn.com") to open webbrowser in this scenario.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, March 17, 2009 7:29 AM
    Moderator
  • We are changing the issue type to “General Discussion” because you have not followed up. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by opening the Options list at the top of the post  window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions. Thank you!


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, March 23, 2009 1:14 AM
    Moderator
  • I provided the offices with 2 options. The first option was to download the ico file from a website and save it to their hard drive, then create the shortcut on each PC's desktop tying that icon to the shortcut. I provided a guide for those that needed instructions on how to do it. The second option was to download a Windows application that uses the icon as it's desktop icon and is used only to launch the website to the PC's default web browser. It's a ClickOnce solutions and checks for updates each time it starts.
    Thursday, May 14, 2009 5:40 PM