Reference/.onInit: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
 
Line 19: Line 19:
   NoAbort:
   NoAbort:
  FunctionEnd</highlight-nsis>
  FunctionEnd</highlight-nsis>
[[Category:Reference/Callback_Functions]]

Latest revision as of 16:42, 28 November 2011

.onInit

This callback will be called when the installer is nearly finished initializing. If the '.onInit' function calls Abort, the installer will quit instantly.

Here are two examples of how this might be used:

 Function .onInit
   MessageBox MB_YESNO "This will install. Continue?" IDYES NoAbort
     Abort ; causes installer to quit.
   NoAbort:
 FunctionEnd

or:

 Function .onInit
   ReadINIStr $INSTDIR $WINDIR\wincmd.ini Configuration InstallDir
   StrCmp $INSTDIR "" 0 NoAbort
     MessageBox MB_OK "Windows Commander not found. Unable to get install path."
     Abort ; causes installer to quit.
   NoAbort:
 FunctionEnd