How to make shortcut of program

Hello

How can I create a shortcut of program on Desktop, Start menu, Program Menu and Start Up Menu

 

Thanks & Regards



Answer this question

How to make shortcut of program

  • Waqar Azeem

    There is an API routine...

    Private Declare Sub HlinkCreateShortcutFromString Lib "hlink.dll" (ByVal grfHLSHORTCUTF As Integer, ByVal pwzTarget As String, ByVal pwzLocation As String, ByVal pwzDir As String, ByVal pwzFileName As String, ByVal ppwzShortcutFile As String, ByVal dwReserved As Integer)

    hlink is in %windir%/system32 in your local friendly operating system.



  • roussec

    Thanks very much
  • ZMT

    When you create your deployment project, you can right click on the project output and choose create shortcut. You'll need to make one for each location. Rename these appropriately. Then you'll need to make folders for each location and move the shortcuts into these folders.

    Search MSDN for "Deployment Projects" for more information.



  • Bryan Avery

    The second is working now.

    You're more likely to find VB6 examples of this than .net examples for several reasons. The first is that it's been around longer. The second is that this is API driven "systemsy" stuff. More of that was done in VB6 than in Dot Net.



  • jmodares.com

    So you want your application to create the shortcuts after it is installed That is, you're not talking about creating them at install time

    In that case, I guess that in theory you could progamatically generate a .LNK file (shorcut) file and place it in the appropriate directories (providing the current user has access to them all), but I'm not sure without looking into it more how you might actually do that; sorry.



  • Manon

    The first link is VB6 code not VB.NET code.

    And second link isn't working.


  • ahossain

    rkimble wrote:

    So you want your application to create the shortcuts after it is installed That is, you're not talking about creating them at install time

    In that case, I guess that in theory you could progamatically generate a .LNK file (shorcut) file and place it in the appropriate directories (providing the current user has access to them all), but I'm not sure without looking into it more how you might actually do that; sorry.

    Hi rkimble:

    You didn't get what I want:

    I want to create a shortcut (.lnk file) of any program I want not my application.

    Thanks


  • westerdaled

     onh1986 wrote:

    The first link is VB6 code not VB.NET code.

    And second link isn't working.

    The first should convert pretty easily. Try it and see what you get. There's a few items you'd need to change, but the upgrade wizard converts most of it OK. The second appears to use the Windows Scripting Host. The latter is probably the easiest. The scripting host has a relatively straightforward method to create shortcuts. Google it: you'll find the download (although it's already installed in the OS) and documentation.

    Or create a setup project: that's the preferable way of creating shortcuts - I don't want programs messing with my stuff after they have installed themselves: that's the sign of a bad program, and a bad programmer.



  • Dylan Beattie

    What must I value "grfHLSHORTCUTF" and "dwReserved"

    Thanks


  • Andalus

  • Madjoo

    Thanks it's a good example
  • gdf

     

    OK,

    I understand what you want to do.

    See if this helps. It's intermediate level code.

    Creating Shortcuts

    Also remember that the difference between creating an icon and creating an icon for any program is the ability to go in an extract an icon from the file and including that in the shortcut.

    In one of these two fora, I've provided a piece of Dot Net code in icon extraction. Use Search and my username and Icon or icon extraction and it's bound to turn up.



  • Mohit Gogia

    Is there a code to create a shortcut
  • How to make shortcut of program