Click to See Complete Forum and Search --> : [RESOLVED] Package wizard -- can I have setup place icon?
FPFalcon
Feb 26th, 2008, 03:21 PM
(I'm pretty much a novice, please be gentle.)
Using VB6 enterprise edition with some MS VB service pack stuff I found, Win XP with current updates.
Is there a way to have the Setup package install a desktop icon to shortcut to the application?
Thanks for your help.
dilettante
Feb 26th, 2008, 03:40 PM
If I recall correctly the Wizard allows you to specify shortcuts and their locations in one of its panels. I think it allows the Desktop as one of these locations.
Personally I wouldn't do it though, and Microsoft is trying to convince developers to stop doing this too.
Windows Vista Application Development Requirements for User Account Control Compatibility
Do not install application shortcuts all over the user’s profile.
While it may be tempting to add your application icon to every known exposure point in Windows, it often results in users feeling that they have lost control of their computer. Users are then forced to manually remove these shortcuts to return the computer to a desired look and feel. If the developer wants to add icons to the desktop, ask the user for permission during the installation. Windows Vista addresses discoverability of applications post install and the most recently used application list to avoid large Start menu traversing.
FPFalcon
Feb 26th, 2008, 04:54 PM
This "reply" was accidental (since "edited" herewith).
I meant to report that:
1) my version of PDWizard definitely does not provide any options bearing on desktop shortcuts, and
2) tests show failure to install a workable "Start -> Programs" link to start the application.
FPFalcon
Feb 26th, 2008, 08:18 PM
(Nothing about shortcuts in my version of PDWizard.)
If we don't provide an icon, how the $%^&*( does the user find the application in the event he/she doesn't pay attention to the setup's mention of destination?
BTW: my tests of the setup show a failed attempt to add the application to the "Start -> Programs" list -- the name is there but it's "<empty>".
dilettante
Feb 27th, 2008, 04:48 PM
The general recommendation is to create a shortcut within a folder under Start Menu|Programs as you've described.
The PDW should offer to create one by default, and in one of the Wizard's panels it gives you the opportunity to delete this, put it somewhere else, or add more shortcuts.
The attached image shows this PDW panel. Perhaps you simply overlooked it?
FPFalcon
Feb 27th, 2008, 08:27 PM
(Thanks for your support!)
Yes, I saw and used that option, but the result was, as mentioned earlier, an <Empty> item under
Start -> Programs -> MyApp -> empty.
My take is that the installation to "Programs" didn't know where the app was installed, maybe? Whatever, I've poked and wiggled and giggled and have been unable to resolve that issue. Anyhow, I feel that a shortcut icon on the desktop would be a "more better" solution if available.
D'you think it's possible that the option for creating a shortcut was eliminated sometime between the original VB6 installation and the later SP5 updates? I haven't had the courage to try this: dump the entire VB installation and re-install from the original CD (no updates applied) and see what the PDWiz will do. (I'm kind of scared that to do so will screw up something in the Registry, for which I'm entirely unequipped to fool with.)
Any thoughts on that?
FPF
FPF
dilettante
Feb 28th, 2008, 06:06 AM
Did you remove the Start Menu item that PDW supplied by default? Otherwise you should have found one (Project1 under the Project1 folder in the image capture above).
I can't imagine SP5 had anything to do with it, but I always make sure to install SP6. I know there are die hards who refuse to install SP6 but they've never offered legitimate reasons when pressed except that Microsoft had released a flawed SP6 the first attempt (back in 2004).
This is a pretty basic "feature" of PDW. I'm sure people would have squawked long ago if it had been broken.
FPFalcon
Feb 28th, 2008, 07:39 PM
Good progress, thank you. I installed VB's service pack 6, and then was able to click on "New item" to add the app's name in the frame of your screen shot. That results in a valid Start -> Programs shortcut.
Nevertheless, I'd prefer to install a desktop icon (ideally only if/when the user checks an option to do so).
I've downloaded and played with the "INNO" installer, which allows me to do that -- but I'm not secure about whether or not that installer will implement the half-dozen VB .dll supporting files. I wouldn't know how to test same in my small-town environment. (I think I've read somewhere that these .dll's need some action to "register" them before they'll be recognized, no?)
I appreciate your help, Dilletante.
FPF
yolandre
Mar 2nd, 2008, 04:46 AM
Try this:
Create the following sub in setup1.frm:
Private Sub CreateShortcut()
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
Dim MyShortcut, MyDesktop, DesktopPath
DesktopPath = WSHShell.specialfolders("AllUsersDesktop")
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\AppName.lnk")
MyShortcut.targetpath = WSHShell.ExpandEnvironmentStrings("C:\MyApp\AppName.exe")
MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings("C:\MyApp")
MyShortcut.WindowStyle = 4
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("C:\MyApp\AppName.exe") & ", 0"
MyShortcut.Save
Err.Clear
End Sub
In the above: MyApp refers to the installation folder and AppName refers to the applications executable file.
Call the newly added sub from setup1.frm’s Form Load event (I use it in ExitSetup) as follow:
Private Sub Form_Load()
ExitSetup:
HideStaticMessageDialog
…
MoveAppRemovalFiles strGroupName
CreateShortcut
…
MainError:
…
End Sub
Shout if you still have problems?
Regards!
yolandre
Mar 2nd, 2008, 04:48 AM
Ooops! Almost posted twice...
FPFalcon
Mar 3rd, 2008, 11:35 AM
I'm sure we have a winner here ... only I have difficulty following the unfamiliar code. I'm getting an error when executing Setup1 -- "invalid procedure or argument" -- which means I've messed-up something in modifying your code to incorporate variable application name, appPath, or some such. Here's the code (not calling as a sub, just invoking it after user says "do it")
MoveAppRemovalFiles strGroupName
'*************************** Here pick up the "CreateShortcut" code
Dim MyChoice
MyChoice = MsgBox("Do you want to put a shortcut on the desktop?", vbYesNo)
If (MyChoice = vbYes) Then
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
Dim MyShortcut, MyDesktop, DesktopPath
DesktopPath = WSHShell.specialfolders("AllUsersDesktop")
' Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\AppName.lnk")
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\" & gstrAppExe + ".lnk")
' MyShortcut.targetpath = WSHShell.ExpandEnvironmentStrings("C:\MyApp\AppName.exe")
MyShortcut.targetpath = WSHShell.ExpandEnvironmentStrings(gstrAppExe)
' MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings("C:\MyApp")
MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings(gstrDestDir)
MyShortcut.WindowStyle = 4
' MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("C:\MyApp\AppName.exe") & ", 0"
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings(gstrAppExe) & ", 0"
MyShortcut.Save
Err.Clear
End If
'*************************** End of shortcut code
You'll see I've commented-out four of your lines and replaced them with what I hoped would serve in the general case. No good.
If you have the patience, could you correct the offending line?
Thanks for your support.
FPF
yolandre
Mar 3rd, 2008, 12:00 PM
Had the same problem, hence split the code into a sub & call the sub only once the actual installation completed.
I've deployed apps this way on all MS operating systems from Win 9.x up to, and including, Vista with no errors.
Added advantage: when you're using PDW to deploy other apps it's easy to just alter the CreateShortcut sub as opposed to fiddling with the FormLoad event.
Hope you got it sorted!
(PS: Only a pleasure to be of service!):)
Regarding your code: why not try DoEvents as follow?
MoveAppRemovalFiles strGroupName
DoEvents
'*************************** Here pick up the "CreateShortcut" code
Dim MyChoice
MyChoice = MsgBox("Do you want to put a shortcut on the desktop?", vbYesNo)
If (MyChoice = vbYes) Then
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
Dim MyShortcut, MyDesktop, DesktopPath
DesktopPath = WSHShell.specialfolders("AllUsersDesktop")
' Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\AppName.lnk")
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\" & gstrAppExe + ".lnk")
' MyShortcut.targetpath = WSHShell.ExpandEnvironmentStrings("C:\MyApp\AppName.exe")
MyShortcut.targetpath = WSHShell.ExpandEnvironmentStrings(gstrAppExe)
' MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings("C:\MyApp")
MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings(gstrDestDir)
MyShortcut.WindowStyle = 4
' MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("C:\MyApp\AppName.exe") & ", 0"
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings(gstrAppExe) & ", 0"
MyShortcut.Save
Err.Clear
DoEvents
End If
'*************************** End of shortcut code
FPFalcon
Mar 3rd, 2008, 03:43 PM
Yolandre ... thanks, you're my good teacher. All works OK.
I have one more question, please, then I'll mark this "resolved". Having edited in the appname, path, etc., how might we prevent the user from choosing a different app path? If he did, the desktop shortcut would be disabled, wouldn't it.
(I seem to think I've seen somewhere that the app path may be made unconditional, but can't find it now.)
Gratefully yours, FPF.
yolandre
Mar 3rd, 2008, 04:54 PM
Apologies FPF! I should have thought about it sooner… The following should do:
MyShortcut.targetpath = WSHShell.ExpandEnvironmentStrings(gstrDestDir & "\" & gstrAppExe)
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings(gstrDestDir & "\" & gstrAppExe) & ", 0"
Once again: only a pleasure & enjoy!
@:)
FPFalcon
Mar 5th, 2008, 09:18 AM
All is well. The results are perfect. Thanks very much.
Now I only need to work out how to mark the thread "resolved".
Is there some place I can learn to read the code you gave me?
Here's the final version of the code added to Setup1 project's frmSetup1 load event:
ExitSetup:
HideStaticMessageDialog
If fWithinAction() Then
'By now, all logging actions should have been either aborted or committed.
MsgError ResolveResString(resSTILLWITHINACTION), vbExclamation Or vbOKOnly, gstrTitle
ExitSetup Me, gintRET_FATAL
End If
MoveAppRemovalFiles strGroupName
'*************************** Here pick up the "CreateShortcut" code
DoEvents
Dim MyChoice
MyChoice = MsgBox("Do you want to put a shortcut on the desktop?", vbYesNo)
If (MyChoice = vbYes) Then
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
Dim MyShortcut, MyDesktop, DesktopPath
DesktopPath = WSHShell.specialfolders("AllUsersDesktop")
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\" & gstrAppExe + ".lnk")
MyShortcut.targetpath = WSHShell.ExpandEnvironmentStrings(gstrDestDir & "\" & gstrAppExe)
MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings(gstrDestDir)
MyShortcut.WindowStyle = 4
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings(gstrDestDir & "\" & gstrAppExe) & ", 0"
MyShortcut.Save
Err.Clear
DoEvents
End If
'*************************** End of shortcut code
ExitSetup Me, gintRET_FINISHEDSUCCESS
73, FPF
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.