bmarzouk
Apr 28th, 2001, 04:51 AM
Hello,
I have made an application using Visual Basic 5.0, I want to distribute
my application using Setup wizard, but setup wizard by default doesn't provide
option to make program group for the application.
How can I alter the "Setup1.vbp" to make program group for my VB application and
make shortcut for the application on Desktop.
Thank you for help,
Belal Marzouk
da_silvy
Apr 28th, 2001, 05:32 AM
The code for shortcut on desktop:
Using the OSfCreateShellLink API
'In a module
Option Explicit
Option Base 1
Public Declare Function OSfCreateShellLink Lib "vb6stkit.dll" Alias "fCreateShellLink" _
(ByVal lpstrFolderName As String, _
ByVal lpstrLinkName As String, _
ByVal lpstrLinkPath As String, _
ByVal lpstrLinkArguments As String, _
ByVal fPrivate As Long, _
ByVal sParent As String) As Long
Public Const gstrQUOTE$ = """"
Public Sub CreateShellLink(ByVal strLinkPath As String, _
ByVal strGroupName As String, _
ByVal strLinkArguments As String, _
ByVal strLinkName As String, _
ByVal fPrivate As Boolean, _
sParent As String, _
Optional ByVal fLog As Boolean = True)
Dim fSuccess As Boolean
Dim intMsgRet As Integer
Dim lREt As Boolean
strLinkName = strUnQuoteString(strLinkName)
strLinkPath = strUnQuoteString(strLinkPath)
If StrPtr(strLinkArguments) = 0 Then strLinkArguments = ""
lREt = OSfCreateShellLink(strGroupName, strLinkName, strLinkPath, strLinkArguments, _
fPrivate, sParent) 'the path should never be enclosed in double quotes
End Sub
Public Function strUnQuoteString(ByVal strQuotedString As String)
'
' This routine tests to see if strQuotedString is wrapped in quotation
' marks, and, if so, remove them.
'
strQuotedString = Trim$(strQuotedString)
If Mid$(strQuotedString, 1, 1) = gstrQUOTE Then
If Right$(strQuotedString, 1) = gstrQUOTE Then
'
' It's quoted. Get rid of the quotes.
'
strQuotedString = Mid$(strQuotedString, 2, Len(strQuotedString) - 2)
End If
End If
strUnQuoteString = strQuotedString
End Function
'On a form
On Error GoTo EH
CreateShellLink "c:\hello.exe", "..\..\Desktop", , "Hello", True, "$(Programs)"
'CreateShellLink strProgramPath, strGroup, strProgramArgs, strProgramIconTitle, True, sParent
Exit Sub
EH:
MsgBox Err.Description
Exit Sub
This example would create a shortcut to "C:\hello.exe", on the Desktop, with a caption of "Hello"
:)
This thread might help you
How To Make My Project Run While Every Time Windows Start ? (http://www.vbforums.com/showthread.php?s=&threadid=71560)
Megatron
Apr 28th, 2001, 07:21 AM
See this link (http://forums.vb-world.net/showthread.php?s=&threadid=71621).