MSI Factory 2.3

MSI.CloseHandle

MSI.CloseHandle

This is the first topic This is the last topic  

MSI.CloseHandle

This is the first topic This is the last topic  

OverviewExamples

boolean MSI.CloseHandle (

number MSIHandle )

Example 1

-- Get the product handle.

nProductHandle = MSI.OpenProduct("{78B82B0B-9AD9-40C0-B994-F72C21B52723}");

 

if (nProductHandle) then

   tbFeatureInfo = MSI.GetFeatureInfo(nProductHandle, "MyTargetFeature", INSTALLFEATUREATTRIBUTE_FAVORLOCAL);

   if (tbFeatureInfo) then

       -- Show a dialog with the feature info.

       Dialog.Message("Feature Info", "Title: "..tbFeatureInfo.Title.."\r\nDescription: "..tbFeatureInfo.Description);

   else

       -- An error occurred.

       nError = Application.GetLastError();

       Dialog.Message("Error", _tblErrorMessages[nError], MB_OK, MB_ICONEXCLAMATION);

   end

 

   -- Finished using the product handle, so close it.

   if (not MSI.CloseHandle(nProductHandle)) then

       Dialog.Message("Error", "Failed to close product handle.");

   end

else

   Dialog.Message("Error", "Failed to get product handle.");

end

Gets the title and description of the "MyTargetFeature" feature and shows it in a dialog message.

Example 2

-- Create a new record

record = MSI.CreateRecord(46546);

 

-- Set an integer

bRecordSet = MSI.RecordSetInteger(record, 6, 17);

 

if bRecordSet then

   Dialog.Message("Success","Record Set properly.");

else

   Dialog.Message("Error","Error setting record.");

end

 

-- Retrieve the integer

nInteger = MSI.RecordGetInteger(record, 6);

 

Dialog.Message("nInteger",nInteger);

 

-- Clear the record

bRecordClear = MSI.RecordClearData(record);

 

-- Try to retrieve the integer again

nCleared = MSI.RecordGetInteger(record, 6);

 

if (nInteger == nCleared) then

   Dialog.Message("Error", "MSI.RecordClearData() failed to clear record.");

end

 

-- Clode the handle to the record

bClosed = MSI.CloseHandle(record);

Creates a record, writes to it, and reads the value. This script also contains some error handling.

See also: Related Actions


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