Archive: warning dialog


warning dialog
I have an installer and it needs 250MB drive space. However, I only have 100MB in my HD. After a few second, the windows of installation directory choosing is shown with a install button disabled. It seems NSIS knows there is not enough space for installation. Now, I want to create a warning dialog to display that information to the user. How can I do it?


In your install page, use this:


PageEx directory
DirVerify leave
PageCallbacks "" "" dirLeave
PageExEnd

Then, in your dirLeave function, call GetInstError $0

If $0 = 2 then there's not enough space.

(see GetInstDirError and DirVerify in the help files for more info).

If using MUI, then you'll need to call !define MUI_DIRECTORYPAGE_VERIFYONLEAVE in your pages section to accomplish the same thing. (Refer to the MUI docs for info on this.)

Thanks!

I follow the instruction and add pageex and a function to it.
However, when I compiled it, it shows a warning message below.
Page instfiles not used, no sections will be executed

And I can't install even there is an enough space.
I have no idea why?


You're missing:
Page InstFiles
or
!insertmacro MUI_PAGE_INSTFILES
(Modern UI)

Edit:
As you appear to be using Modern UI, you shouldn't use PageEx.
You should use:

!define MUI_DIRECTORYPAGE_VERIFYONLEAVE
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE dirLeave
!insertmacro MUI_PAGE_DIRECTORY

-Stu


I use pageex. When I insert "Page instfiles" in my code, the installer will run and install program once I click the installer. After that it shows me the installation directory selection windows with a "Close" button enabled. Below is my code and I donno what's wrong with it.

Name "superprogram"
InstallDir "C:\somedirectory"
OutFile "superprogram.exe"

Page instfiles
DirText "Choose directory to install ..."

SetCompress Off
CRCCheck off

PageEx directory
DirVerify leave
PageCallbacks "" "" dirLeave
PageExEnd

Function dirLeave
...
FunctionEnd

Section "superinstaller"
SetOutPath "$INSTDIR\"
File "c:\somefiles"
...
SectionEnd


Try putting the PageEx before the instfiles page.


I just about to say that!
;)

As it is now, the installation is off installing files before it ever asks the user were to install. (minor details...)
:)


Get it. Thanks!