Posts: 1,271
	Threads: 399
	Joined: Mar 2003
	
	
 
	
	
		i have a shortcut on desktop where i change the icon on result of a function.
currently i use CreateShortcutEx for updating the icon, but i would prefer to update the .lnk
without overwriting it.
i use stardock fences to organize my desktop icons in areas, unfortunately it tries to handle
my shortcut because it has been created again.
i would like to change only the icon info and send some kind of refresh to desktop.
thanks
	
	
	
	
	
 
 
	
	
	
		
	Posts: 12,239
	Threads: 144
	Joined: Dec 2002
	
	
 
	
	
		Function 
ChangeShortcutIcon 
;/
function $lnkFile $iconFile [iconIndex]
;Changes shortcut icon.
;Error if lnkFile or iconFile does not exist or lnkFile is read-only.
;EXAMPLE
;ChangeShortcutIcon "$desktop$\Macro1284.lnk" "shell32.dll" 9
str slnk sico
slnk.expandpath(lnkFile)
if(!dir(slnk) or !sico.searchpath(iconFile)) end "file not found"
IShellLinkW psl
IPersistFile ppf
psl._create(CLSID_ShellLink)
ppf=+psl
ppf.Load(@slnk STGM_WRITE)
psl.SetIconLocation(@sico iconIndex)
ppf.Save(0 1)
err+ end _error
 
 
	
	
	
		
	Posts: 1,271
	Threads: 399
	Joined: Mar 2003
	
	
 
	
	
		thanks for your help.
it seems that using desktop shortcuts is the wrong approach.
i need to build something like stardock fences later on with qm, because shortcut change is wrong interpreted by fences.
my desktop icon arrangement is disturbed when using qm. 
such mis-functionality drives me mad.  :oops:  
it makes more sense to create an own desktop icon area toolbar with qm.
so sorry to bother again,
what is the best way to change a button icon on a qm toolbar?
like on click and drop.
	
	
	
	
	
 
 
	
	
	
		
	Posts: 12,239
	Threads: 144
	Joined: Dec 2002
	
	
 
	
	
		Easiest - getmacro/replace/setmacro.
Another way - replace icon in toolbar's imagelist. Not sure it is possible, but can try to create such function tomorrow.
	
	
	
	
	
 
 
	
	
	
		
	Posts: 1,271
	Threads: 399
	Joined: Mar 2003
	
	
 
	
	
		does setmacro update a toolbar on the fly?
	
	
	
	
	
 
 
	
	
	
		
	Posts: 12,239
	Threads: 144
	Joined: Dec 2002
	
	
 
	
	
		yes
but this way is quite slow
	
	
	
	
	
 
 
	
	
	
		
	Posts: 1,058
	Threads: 367
	Joined: Oct 2007
	
	
 
	
	
		I found it very useful. However I found that "ppf.Save" looses shortcut content. Please advise.
	
	
	
	
	
 
 
	
	
	
		
	Posts: 12,239
	Threads: 144
	Joined: Dec 2002