Old 8th October 2005, 11:10   #1
softwaredevelop
Junior Member
 
Join Date: Oct 2005
Posts: 1
changing the default icon for a directory

I am trying to create a directory and use a different icon for the folder - is this possible?

This is the code for creating the directory - what would be the next step?

CreateDirectory "$Desktop\Primary Applications"
softwaredevelop is offline   Reply With Quote
Old 8th October 2005, 13:22   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
If you create a file named Desktop.ini in the folder, you can put this in it to change the icon:
code:
[.ShellClassInfo]
IconFile=%SystemRoot%\system32\SHELL32.dll
IconIndex=12

You can use WriteINIStr to write INI files. Note that this feature was not available on all Windows versions.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 8th October 2005, 16:00   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
it works on 98 and up (should work on 95+ie4 shellupdate)
just remember to make the desktop.ini file hidden+system+read-only
and the folder should be read-only+system

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 8th October 2005, 17:00   #4
Comm@nder21
Major Dude
 
Join Date: Jul 2003
Location: germany, b-w
Posts: 734
Send a message via ICQ to Comm@nder21
this macro prepares any given folder to apply desktop.ini
i used it with success.
code:
!define PathMakeSystemFolder "!insertmacro PATH_MAKE_SYSTEM_FOLDER"
!macro PATH_MAKE_SYSTEM_FOLDER pszPath
System::Call "shlwapi::PathMakeSystemFolder(t '${pszPath}') i."
!macroend



call it that way:
code:
${PathMakeSystemFolder} "C:\MyFolder"
Comm@nder21 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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