Sometimes, we want to add a shortcut to our program. Of course, after the program is installed, we can do this by clicking on the executable file of our program, right-clicking and selecting Add desktop shortcut. But sometimes we want to automatically implement it through programming. What to do? We can call API functions to achieve this. The source code is given below:
Private Declare Function fCreateShellLink Lib vb5stkit.DLL (ByVal _
lpstrFolderName As String, ByVal lpstrLinkName As String, ByVal _
lpstrLinkPath As String, ByVal lpstrLinkArgs As String) As Long
Private Sub MakeShortCuts()
Dim lReturn As Long
Dim MyPath As String
Dim MyName As String
MyPath = App.Path
MyName = App.EXEName
'Add to desktop
lReturn = fCreateShellLink(../../Desktop, _
Shortcut to Net Timer, MyPath & / & MyName, )
'Add to startup group
lReturn = fCreateShellLink(/start, Shortcut to Net Timer, _
MyPath & / & MyName, )
End Sub
How about it? It's very simple, right?