|
-
Feb 26th, 2008, 04:21 PM
#1
Thread Starter
New Member
[RESOLVED] Package wizard -- can I have setup place icon?
(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.
-
Feb 26th, 2008, 04:40 PM
#2
Re: Package wizard -- can I have setup place icon?
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.
-
Feb 26th, 2008, 05:54 PM
#3
Thread Starter
New Member
Re: Package wizard -- can I have setup place icon?
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.
Last edited by FPFalcon; Feb 28th, 2008 at 08:28 PM.
-
Feb 26th, 2008, 09:18 PM
#4
Thread Starter
New Member
Re: Package wizard -- can I have setup place icon?
(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>".
-
Feb 27th, 2008, 05:48 PM
#5
Re: Package wizard -- can I have setup place icon?
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?
-
Feb 27th, 2008, 09:27 PM
#6
Thread Starter
New Member
Re: Package wizard -- can I have setup place icon?
(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
-
Feb 28th, 2008, 07:06 AM
#7
Re: Package wizard -- can I have setup place icon?
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.
-
Feb 28th, 2008, 08:39 PM
#8
Thread Starter
New Member
Re: Package wizard -- can I have setup place icon?
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
-
Mar 2nd, 2008, 05:46 AM
#9
Addicted Member
Re: Package wizard -- can I have setup place icon?
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!
-
Mar 2nd, 2008, 05:48 AM
#10
Addicted Member
Re: Package wizard -- can I have setup place icon?
Ooops! Almost posted twice...
Last edited by yolandre; Mar 2nd, 2008 at 05:52 AM.
-
Mar 3rd, 2008, 12:35 PM
#11
Thread Starter
New Member
Re: Package wizard -- can I have setup place icon?
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
Last edited by FPFalcon; Mar 3rd, 2008 at 12:40 PM.
-
Mar 3rd, 2008, 01:00 PM
#12
-
Mar 3rd, 2008, 04:43 PM
#13
Thread Starter
New Member
Re: Package wizard -- can I have setup place icon?
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.
-
Mar 3rd, 2008, 05:54 PM
#14
Addicted Member
Re: Package wizard -- can I have setup place icon?
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!
@
-
Mar 5th, 2008, 10:18 AM
#15
Thread Starter
New Member
Re: Package wizard -- can I have setup place icon?
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
Last edited by FPFalcon; Mar 7th, 2008 at 08:10 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|