Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Create application shortcut

Create application shortcut

Scheduled Pinned Locked Moved Visual Basic
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_538383
    wrote on last edited by
    #1

    Hi Is there a function that let me create a shortcut to an app? say on the desktop? Thanks

    D V 2 Replies Last reply
    0
    • M Member_538383

      Hi Is there a function that let me create a shortcut to an app? say on the desktop? Thanks

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      There is no function in the .NET BCL that will handle this. You will have to use the Microsoft Scripting Runtime (set a COM reference to this!), create a Windows Scripting Shell object and use it to create the shortcut. Something like this (I think!):

       Dim WshShell As New WScript.Shell
       Dim oShellLink As WScript.Shortcut = WshShell.CreateShortcut(strDesktopPath & "\\Shortcut Script.lnk")
       oShellLink.TargetPath = WScript.ScriptFullName
       oShellLink.WindowStyle = 1
       oShellLink.Hotkey = "CTRL+SHIFT+F"
       oShellLink.IconLocation = "notepad.exe, 0"
       oShellLink.Description = "Shortcut Script"
       oShellLink.WorkingDirectory = strDesktop
       oShellLink.Save
      

      I haven't tested this code, but it should look SOMETHING like this. I don't have Visual Studio where I'm at work, so I would have to wait until I got home to create a runnable example. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      1 Reply Last reply
      0
      • M Member_538383

        Hi Is there a function that let me create a shortcut to an app? say on the desktop? Thanks

        V Offline
        V Offline
        VenkatFor NET
        wrote on last edited by
        #3

        See if you can consider creating shortcut at the time of deployment wherever you need using Setup projects. I suppose, this would be the best .NET solution. BK

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups