CreateLinkIco




'Windows API/Global Declarations for :MakeIcons

'***********************************************

Private Declare Function fCreateShellLink Lib _
"vb6stkit.dll" (ByVal lpstrFolderName As String, _
ByVal lpstrLinkName As String, _
ByVal lpstrLinkPath As String, _
ByVal lpstrLinkArgs As String, _
ByVal fPrivate As Integer, _
ByVal sParent As String) As Long

Public Function CreateIcon(IconTitle As String, _
ProgramPath As String, _
Optional PutWhere As Integer = 0) As Boolean

On Error Goto ErrorHandler
Select Case PutWhere
Case 0 'desktop
fCreateShellLink "..\..\Desktop", IconTitle,_
ProgramPath, "", -1,"$(Programs)"
CreateIcon = True
Case 1 'StartMenu/Programs
fCreateShellLink "..\Programs", IconTitle, _
ProgramPath, "", -1,"$(Programs)"
CreateIcon = True
Case 2 'StartMenu
fCreateShellLink "..", IconTitle, ProgramPath, _
"", -1,"$(Programs)"
CreateIcon = True
Case 3 'StartMenu/Programs/Startup
'will auto run at startup

fCreateShellLink "..\Programs\StartUp", _
IconTitle, ProgramPath, "", -1, _
"$(Programs)"
CreateIcon = True
Case Else 'invalid call Get out
CreateIcon = False
End Select
ErrorHandler:
CreateIcon = False
End Function

Inputs:
Parameters are IconTitle the words you want displayed
under the icon, ProgramPath the path to the program you
want to link to, and an optional parameter PutWhere if
left blank the icon will be put on the desktop PutWhere
is a Integer value

0 = Desktop
1 = startmenu\programs
2 = startmenu
3 = startup folder

entering 3 will cause the program To launch itself every
time the computer is started

Returns:
true if icon was created false if their was an error










( createlinkico.html )- by Paolo Puglisi - Modifica del 17/12/2023