Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Update .lnk icon
#2
Function ChangeShortcutIcon
Code:
Copy      Help
;/
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


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)