Archive: MUI_HWND not recognised


MUI_HWND not recognised
  Hello,

I am trying to hide the 'RUN' checkbox on the finishpage on a condition.

Using the following function:

Function HideCheckbox

${If} $InstallationChoice == "deinstall"
GetDlgItem $R9 $MUI_HWND "1203"
ShowWindow $R9 ${SW_HIDE}
${EndIf}
>FunctionEnd
>
Defined like this:

define MUI_PAGE_CUSTOMFUNCTION_SHOW                HideCheckbox 

>
But, the compiler give me a warning:

unknown variable/constant "MUI_HWND" detected, ignoring (installatie_keuze.nsh:63) 

And the function doesn't work.
The function is called and the condition is true, but $R9 is always 0

Am I missing something?

If you're using MUI2 there's no longer a MUI_HWND variable. Instead you want $mui.FinishPage (or for the check boxes; $mui.FinishPage.Run or $mui.FinishPage.ShowReadme).

Stu


I am using MUI 1

!include "MUI.nsh" 

Switch to MUI2?

Stu


Same problem.

Johan


In which case you must be using the variables before they are defined in the script.

Stu


I don't think so.

I include the NSIS .nsh files before I include my own .nsh files.

The function 'HideCheckbox' is in a seperate .nsh file that's included after the MUI.nsh

I don't have to define the $MUI_HWND variable in my script?

Johan


The MUI_HWND variable is defined when you !insertmacro MUI_PAGE_WELCOME or !insertmacro MUI_PAGE_FINISH. You cannot reference it before. And seriously, unless you are using InstallOptions in your installer, you should switch to MUI2. It uses nsDialogs for its custom pages which is a lot faster than InstallOptions (and has less overhead).

Stu


Switched to MUI2.

Changed $MUI_HWND to $mui.FinishPage.Run

Getting warning:

unknown variable/constant "mui.FinishPage.Run" detected, ignoring (installatie_functies.nsh:89) 

Order of includes and pages:

....

!
define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
!define MUI_FINISHPAGE_TITLE_3LINES
!insertmacro MUI_PAGE_WELCOME

>; License page
!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE ${LICENCEFILE}
;--------------------------------------------------------------------------------------------------

; custom pages
Page custom InstallChoiceInit InstallChoiceValidate
Page custom InstallTypeInit InstalTypeValidate
>.... More pages


>; Finish page
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Start MyApp"
!define MUI_FINISHPAGE_RUN_FUNCTION RunApplication

!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_TEXT "View Log"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowLogFile
!define MUI_PAGE_CUSTOMFUNCTION_SHOW HideCheckbox

!insertmacro MUI_DEFAULT MUI_FINISHPAGE_TITLE "Completing installation."
!insertmacro MUI_DEFAULT MUI_FINISHPAGE_TEXT "The installation completed."
!insertmacro MUI_PAGE_FINISH
>
The functions 'RunApplication', 'ShowLogFile' and 'HideCheckbox' are placed in a seperate file (Install_Functions.nsh)

Johan

Then you're probably including your Install_Functions.nsh before you're inserting the page macros.


Had to split my 'Install_Functions.nsh' into 2 files.
Moved the split off part to a position after the Finish_Page definition.

Then it works.

I am not happy to have include files on more than 1 place in the code.:down:
It's getting to be a mess. (I have just under 200 include files, and the .NSI alone is over 15.000 lines)

B.T.W.
Are there rules where to place certain parts of code? The help isn't clear about that.
We want to have equal call grouped together:
First all constants
Second all variables
Next all includes (Split into NSIS internal, Project specific, Custom pages)
Next all page definitions
Finally _PRE, _SHOW and _LEAVE functions

Johan


There are no rules, (except for the order of MUI macro/defines for example) it's just a matter of getting it right so that it builds OK. However I would always place functions after page definitions (and sometimes after sections too). How about moving your page definitions to another include?

Stu