Search code examples
nsis

NSIS: How to remove/hide MUI_LICENSEPAGE_TEXT_BOTTOM?


Hello to you who is reading this post. About a week ago I discovered NSIS and have just about managed to finish my first installer script. I managed to find answers to pretty much all of my questions through web searches, and have managed to create a pretty elaborate installer. There is one issue I can't figure out, as everything I have tried does not work and I can't find a solution online that I understand or is specific enough to be applied to this issue.

I'm using the modern UI "MUI2". I found some code to increase the size of the rich textbox on the license page which works great, but now the text at the bottom of the window (MUI_LICENSEPAGE_TEXT_BOTTOM) overlaps it and causes some visual bugs. Setting it to an empty string does not work and setting it to a single space does not work. I managed to get it to disappear with "FindWindow" and "GetDlgItem", but I'm not exactly a programmer so I don't have the intelligence or knowledge on how to set these up correctly. What I did manage to pull off, it also removed the rich textbox, and after several hours of defeat I finally gave up and turned to the internet.

It's kind of mind blowing to me that NSIS does not provide a simple way to remove controls. I don't want the "text bottom" label there at all, I want it gone or at the very least hidden. I know the handle I'm trying to remove is "1006" because I opened up the installer in Resource Hacker and removed the label from there. What bugs the me most is that actually worked perfectly and removes the label, but it also corrupts the installer and I have to use NCRC on command line to launch it. So scratch that as a workable solution...

TL;DR my question is: how do I hide or get rid of MUI_LICENSEPAGE_TEXT_BOTTOM?


Solution

  • MUI2 already has a variable you can use:

    !include MUI2.nsh
    !define MUI_PAGE_CUSTOMFUNCTION_SHOW HideMui2Text
    !insertmacro MUI_PAGE_LICENSE
    !insertmacro MUI_LANGUAGE "English"
    
    Function HideMui2Text
    ShowWindow $mui.LicensePage.Text 0
    FunctionEnd
    

    If you wanted to do it manually it would be

    FindWindow $0 "#32770" "" $HWNDPARENT ; Find inner page
    GetDlgItem $1 $0 1006 ; Find control
    ShowWindow $1 0
    

    When using Resource Hacker you need to copy the base file from NSIS\Contrib\UIs and in your script define MUI_UI to the path of your modified UI file.