MSI Factory 2.3

System.IsSystemRestoreAvailable

System.IsSystemRestoreAvailable

This is the first topic This is the last topic  

System.IsSystemRestoreAvailable

This is the first topic This is the last topic  

OverviewExamples

boolean System.IsSystemRestoreAvailable (

)

Example 1

bRestore = System.IsSystemRestoreAvailable();

Stores true in the variable "bRestore" if the system restore service is available, or false if not.

Example 2

-- Check to see if the system has system restore capability

bSysRestoreAvailable = System.IsSystemRestoreAvailable();

 

if bSysRestoreAvailable then

   -- Restore is available, mark start point

   nSequenceNum = System.SetRestorePoint(SYSTEM_CHANGE_BEGIN, SYS_RESTORE_APP_INSTALL, 0, "Installed Sample Product v. 3.7")

else

   -- Restore is unavailable, confirm with the user to continue

   nChoice = Dialog.Message("Restore Unavailable", "Your system does not support System Restore.  Do you want to continue with the setup?", MB_YESNO, MB_ICONSTOP);

 

   if nChoice == 7 then

       -- The user chose not to continue, exit the script

       Application.ExitScript();

   end

end

 

 

-- DO UPDATE TASKS HERE

 

 

if bSysRestoreAvailable then

   -- Restore is available, mark end point

   nSequenceNum = System.SetRestorePoint(SYSTEM_CHANGE_END, SYS_RESTORE_APP_INSTALL, nSequenceNumber, "Installed Sample Product v. 3.7")

 

   -- Write sequence number to the registry for later use

   Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\MyCompany\\MyProduct\\RestorePointInfo", "SequenceNumber", nSequenceNum, REG_SZ)

end

Checks if the user's system supports system restore. If it does not, the user is asked if it should continue. If the system supports system restore, or the user chooses to continue, a restore point is set and the application tasks are completed.

See also: Related Actions


Learn More: Indigo Rose Software - MSI Factory - Buy Now - Contact Us