Skip to content
⌘ NSIS Forum Archive

How can I disable the dropdown listbox in component page?

9 posts

bluenet#

How can I disable the dropdown listbox in component page?

I try

!include "WinMessages.nsh"

and

FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R0 $R0 1022
EnableWindow $R0 0

but not work,what's wrong?
flizebogen#
If you don't use the command INSTTYPE the dropdown listbox won't show up.
Then you only see the section(s) in a tree view.
Joost Verburg#
Why are you using installation types anyway if you don't want the user to be able to choose?

Did you put that code in the show function of the components page?
bluenet#
The reason is that I want to make a "Choose Install Options" Page like Winamp installer. So I want to make one components page show insttype and the next one not show.
bluenet#
Sorry,these is my code

Name                 "Test"
Caption              "Test"
SetCompressor        lzma
ShowInstDetails      show
OutFile              ".\test.exe"
!include "MUI.nsh"
!include "Sections.nsh"
!include "WinMessages.nsh"
  !insertmacro MUI_PAGE_COMPONENTS
  !insertmacro MUI_PAGE_DIRECTORY
  !define MUI_PAGE_CUSTOMFUNCTION_PRE ComponentsPage
  !insertmacro MUI_PAGE_COMPONENTS
  !insertmacro MUI_PAGE_INSTFILES
;  !insertmacro MUI_PAGE_FINISH
  !insertmacro MUI_LANGUAGE "SimpChinese"
    InstType "Full"                   # INSTTYPE_1
    InstType "Typical"                # INSTTYPE_2
    InstType "Needed on this system"  # INSTTYPE_3
    InstType "None"                   # INSTTYPE_4
Section "-post"
   SetAutoClose         false
SectionEnd
Function ComponentsPage
    Push $R0
  FindWindow $R0 "#32770" "" $HWNDPARENT
  GetDlgItem $R0 $R0 1017
    EnableWindow $R0 0
;  SendMessage $R0 ${WM_CLOSE} 0 0
  Pop $R0
FunctionEnd
Section "test1"
SectionEnd 
kichik#
Use the show function. The dialog does not exist when the pre function is called. To hide a window, use ShowWindow instead of EnableWindow.