Skip to content
⌘ NSIS Forum Archive

NSIS directory page checkbox

3 posts

Endy-kun#

NSIS directory page checkbox

Hi. By looking at 103 DIALOGEX in modern.exe, which I believe belongs to the "directory" page, I see that it contains CONTROL "", 1008, BUTTON, BS_AUTOCHECKBOX that appears to be disabled.

What it is used for? How can I enable it in my installer and make open readme.txt after install (if checked?) I don't want to use final page for this purpose.
Anders#
This checkbox is only used in the special logging builds and you have to hold down shift to make it visible.

You really should be using the components page or the finish page for this but if you really must:

var ShowReadme

Page Directory "" OnDirPageShow OnDirPageLeave
Page Instfiles

!include WinMessages.nsh
!include nsDialogs.nsh
!include LogicLib.nsh

Function OnDirPageShow
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 0x3F0
SendMessage $0 ${WM_SETTEXT} 0 "STR😁isplay readme"
ShowWindow $0 1
${NSD_SetState} $0 $ShowReadme
FunctionEnd

Function OnDirPageLeave
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 0x3F0
${NSD_GetState} $0 $ShowReadme
FunctionEnd

Section
${If} $ShowReadme <> 0
ExecShell "" "$InstDir\ReadMe.txt"
${EndIf}
SectionEnd
Note: If you have RequestExecutionLevel admin/highest in your code then this might run Notepad as the wrong user...
Endy-kun#
Oh, thanks! To be honest, I expected the usage of this checkbox to be a bit less niche...

Yes, installer requires elevated privileges, but if notepad will run elevated, I don't see it as a problem...
"components page" might be an option, but again my installer has a few pages already, i just need to stick one more checkbox somewhere and thought that doing it n the "directory" page will be easier.