> I need to add a shortcut to the Startup group for an app being
installed.
I> s there a simple way to do this using setup.lst?
> Thanks,
> Pete
Thanks to several contributors in another forum, I solved this problem.
Somehow the thread got off target -- I needed to create a shortcut in the
Startup group, not on the Desktop. The subtle difference is that there is
a private Startup and a public Startup. To make the shortcut run when any
user logs on, the 5th parameter of the CreateShellLink call (fPrivate)
should be false. To make the shortcut run for only the user installing
the app, make it true. Here's the solution:
1. Create a copy of the Setup1 project.
2. In frmSetup1:
' original code
' Case UCase$(gsSTARTMENUKEY), UCase$(gsPROGMENUKEY)
' new code
Case UCase$(gsSTARTMENUKEY),
UCase$(gsPROGMENUKEY), "STARTUP"
This change causes Setup1 to bypass creation of the Startup group as if it
were an application group, because it already exists.
3. In basSetup1.CreateIcons:
' original code
' CreateShellLink strProgramPath, strGroup,
strProgramArgs, strProgramIconTitle, fPrivate, sParent
' new code
If UCase(strGroup) = "STARTUP" Then
strGroup = "\Startup"
CreateShellLink strProgramPath, strGroup,
strProgramArgs, strProgramIconTitle, 0, sParent
Else
CreateShellLink strProgramPath, strGroup,
strProgramArgs, strProgramIconTitle, fPrivate, sParent
End If
This change causes Startup shortcuts to be created in the Startup group.
I hard coded mine to make it startup for All Users (fPrivate = False).
4. Compile Setup1
5. Run the PDWizard on your project. In the SETUP.LST file created by
PDWizard:
a. Change the IconGroups section from this:
[IconGroups]
Group0=yourappgroup
PrivateGroup0=-1
Parent0=$(Programs)
to this:
Group0=yourappgroup
PrivateGroup0=-1
Parent0=$(Programs)
Group1=Startup
PrivateGroup1=-1
Parent1=$(Programs)
If there is already a Group1, make the new one Group2 or 3, and
renumber the PrivateGroup and Parent keywords appropriately.
b. Add a new Startup group after your app's group:
[Startup]
Icon1="yourapp.exe" /S (this is an example of passing a
parameter of "/S" to yourapp.exe)
Title1=yourappname
StartIn1=$(AppPath)
Reminder: You can debug Setup1 by changing the Spawn keyword at the top
of SETUP.LST as follows:
; Spawn=Setup1.exe
Spawn=c:\progra~1\micros~4\VB98\VB6.exe c:\progra~1\devstu~1\vb\backup~4
\setup1.vbp /cmd
Be sure to get the folder shortnames right for your environment. Then run
Setup. The IDE will start and you'll be able to set breakpoints before
running.
Hope this helps. If anyone sees a problem with it, I'd appreciate a heads
up.
Pete