Tuesday, May 07, 2024

how to show a dialog box in wix

 

Sometime we may want to show a dialog box to user from installation package, below is an example

<CustomAction Id="ConfirmAndCleanUpOldFolder"
             
Script="vbscript"
             
Execute="immediate">
 <![CDATA[
   On Error Resume Next
   Set WshShell = CreateObject("WScript.Shell")
   strProgramData = WshShell.ExpandEnvironmentStrings("%ProgramData%")
   strFolderPath = strProgramData & "\sompath\"
   Set fso = CreateObject("Scripting.FileSystemObject")
   If Session.Property("UILevel") = 4 And fso.FolderExists(strFolderPath) Then
     result = MsgBox("An older version of the data folder exists, which is no longer necessary for the application's operation. Would you like to remove it now ? " & strFolderPath, vbYesNo + vbSystemModal, "Clean up redundant files")
     If result = vbYes Then
       fso.DeleteFolder strFolderPath, True
       If Err.Number <> 0 Then
         MsgBox "Failed to delete folder: " & Err.Description
       Else
         Session.Property("OLD_FOLDER_CLEANED") = "yes"
       End If
     End If
   End If
   On Error GoTo 0
 
]]>
</CustomAction>
and put 
<InstallExecuteSequence>
 <Custom
Action="ConfirmAndCleanUpOldFolder" After="InstallInitialize" />

No comments:

install qscintilla in windows

 In order to install qscintilla we have to compile the code and install. Find the make install output from my windows below ozkan@HP-ENVY...