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:

sony xperia 10 VI did not like the case

After iphone 16 I wanted to test an android and looks like sony xperia 10 VI is nice, which is 6.1 inches, but it was narrow and longer than...