Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 18th August 2004, 07:43   #1
Voxen2
Junior Member
 
Join Date: Aug 2004
Posts: 6
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
Voxen2 is offline   Reply With Quote
Old 18th August 2004, 10:19   #2
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,353
Send a message via ICQ to deguix
To refresh the desktop, use the code below:

code:
!include WinMessages.nsh

Function .onInit
SendMessage "${HWND_BROADCAST}" "${WM_SETTINGCHANGE}" "" ""
FunctionEnd


My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 18th August 2004, 10:53   #3
Voxen2
Junior Member
 
Join Date: Aug 2004
Posts: 6
Quote:
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).
Voxen2 is offline   Reply With Quote
Old 18th August 2004, 11:13   #4
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,353
Send a message via ICQ to deguix
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.

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 18th August 2004, 13:09   #5
scully13
Senior Member
 
Join Date: Apr 2004
Posts: 130
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.
scully13 is offline   Reply With Quote
Old 19th August 2004, 08:19   #6
Voxen2
Junior Member
 
Join Date: Aug 2004
Posts: 6
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.
Voxen2 is offline   Reply With Quote
Old 19th August 2004, 12:24   #7
zimsms
Senior Member
 
zimsms's Avatar
 
Join Date: Jan 2004
Location: London, Ontario, Canada
Posts: 272
The following will assure only one instance.

code:

!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:

...

zimsms is offline   Reply With Quote
Old 19th August 2004, 20:09   #8
Voxen2
Junior Member
 
Join Date: Aug 2004
Posts: 6
Thanks a lot, I'll try this.
Voxen2 is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump