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.
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.
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.
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.
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.
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.
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.
How to create shortcut of program
SimpleSimon
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.
SergeK
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.
Olcay
The first link is VB6 code not VB.NET code.
And second link isn't working.
wadezone
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.
Alex-MSFT
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.
Mike Kidd
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
Tyler Sample
dmihailescu
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.
Tim HK Wong
danwsc
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.
Greg Thomas - UK
And here's a good one
http://www.vbdotnetheaven.com/Code/Jun2003/2006.asp
dilibu
Todd Weber
What must I value "grfHLSHORTCUTF" and "dwReserved"
Thanks