Skip to content
⌘ NSIS Forum Archive

toggle section read only status?

4 posts

Angus Leeming#

toggle section read only status?

I would like to use the isUserAdmin function (http://nsis.sourceforge.net/archive/...php?pageid=275) to toggle the read only status of a section or, alternatively, to hide the section altogether if the user does not have admin privileges.

Is such a thing possible?

Angus
glory_man#
Use SectionIn RO inside section to install read-only attrib, if user does not have privileges.

..section..
Call IsUserAdmin
Pop $R0
StrCmp $R0 "true" ok 0
SectionIn RO
.. other actions ..
ok:
.....
Or use SectionSetFlags.
the fifth bit represents whether the section is read-only,
To hide section change the description using SectionSetText.
Angus Leeming#
Perfect. Just for info, here's the code.

Many thanks,
Angus
Afrow UK#
Or you can just change the Section's text with SectionSetText
If you set its name to nothing "" or "-blah" it will become hidden.

-Stu