Voxen2
18th August 2004 08:43 UTC
Desktop icon duplicated four times
Hi,
When installing my application, the desktop icon is duplicated 4 times, i.e. I see 4 icons of my application on the desktop, all of them pointing to the same EXE.
If I refresh the desktop with F5 then only one remains.
This is the script command I use to create the desktop icon:
CreateShortCut "$DESKTOP\MyApp.lnk" "$INSTDIR\myapp.exe"
That never happened with previous versions of my software, however on the last install script I added the "SetShellVarContext all" in order to have the installation shared with all users. Is that related?
What can I do?
Thanks
deguix
18th August 2004 11:19 UTC
To refresh the desktop, use the code below:
!include WinMessages.nsh
Function .onInit
SendMessage "${HWND_BROADCAST}" "${WM_SETTINGCHANGE}" "" ""
FunctionEnd
Voxen2
18th August 2004 11:53 UTC
Originally posted by deguix
To refresh the desktop, use the code below:
Thanks but this is a workaround to the problem.
I'd like that it just doesn't happen (if possible).
deguix
18th August 2004 12:13 UTC
This is probably a scripting problem.
Remember: You can debug any part of the script using MessageBox command or using DumpState plugin. So even you can solve the problem here.
Or you can attach your script if you want it fast or sure.
scully13
18th August 2004 14:09 UTC
I've seen this happen when a shortcut with the same name already exists under the "all users" area and then you add the same shortcut under the "current user". You can also get the problem to occur by creating the shortcuts through Windows so it appears to be a Windows issue. I've seen it happen other times but never really nailed down the cause. I guess you could check you script to make sure your not doing something like creating duplicate shortcuts.
Voxen2
19th August 2004 09:19 UTC
I have only one call to:
CreateShortCut "$DESKTOP\MyApp.lnk" "$INSTDIR\myapp.exe"
If there is no solution I'll try the workaround proposed by deguix.
zimsms
19th August 2004 13:24 UTC
The following will assure only one instance.
!include "WinMessages.nsh"
...
IfFileExists "$DESKTOP\MyApp.lnk" lblAlreadyExists
CreateShortCut "$DESKTOP\MyApp.lnk" "$INSTDIR\myapp.exe"
Goto LblDone
lblAlreadyExists:
; the following will replace the existing shortcut, hope it was yours. This insures your target is right.
delete "$DESKTOP\MyApp.lnk"
CreateShortCut "$DESKTOP\MyApp.lnk" "$INSTDIR\myapp.exe"
; refresh incase incon changed since bloody windows caches them.
SendMessage "${HWND_BROADCAST}" "${WM_SETTINGCHANGE}" "" ""
lblDone:
...
Voxen2
19th August 2004 21:09 UTC
Thanks a lot, I'll try this.
;)