PDA

View Full Version : Changing MEDIA type in a Release



rockywurden
01-07-2005, 06:13 PM
Using ISWiProject in VB is there a way to change the MEDIA TYPE in a NEW Release?
The following is a code sample.
'/////////////////////////////////
Set pProject = New ISWiProject

pProject.OpenProject "C:\TEST\TEST.ISM", True

Dim pProdConfig As ISWiProductConfig
Set pProdConfig = pProject.ISWiProductConfigs.Item("NEWDATA")

'Set GUID for New Release
Dim sProps As String
sProps = pProject.GenerateGUID
pProdConfig.PackageCode = sProps
sProps = pProject.GenerateGUID
pProdConfig.UpgradeCode = sProps
sProps = pProject.GenerateGUID
pProdConfig.ProductCode = sProps

pProdConfig.ProductName = "TEST5"
'////RELEASE 1 was built in IDE with RELEASE WIZARD
'////MEDIA TYPE IS CD-ROM

Set prelease1 = pProdConfig.ISWiReleases.Item("Release 1")
prelease1.build

'/////Create a NEW RELEASE
pProdConfig.AddRelease ("R_TESTNEW")
Set prelease1 = pProdConfig.ISWiReleases.Item("R_TESTNEW")

prelease1.IFTWCabSizeInKb = 0
prelease1.SetupEXE = True
prelease1.Compressed = True
prelease1.CreateAutorunINF = True
prelease1.InstallScriptEngineLocation = 1
prelease1.MSIEngineLocation = 1
prelease1.TargetOS = 3
prelease1.Build

pProject.SaveProject

pProject.CloseProject
'/// To check the MEDIA TYPE use the IDE and look at the R_TESTNEW. The Release is a NEWWORK IMAGE.

Is there a way to change the MEDIA TYPE on a RELEASE?
Thanks

RobertDickau
01-10-2005, 02:37 PM
For modifying ISM database tables that aren't exposed in the InstallShield 10.5 Automation interface, you can use the MSI Automation interface, as in: http://www.installshield.com/news/newsletter/0402-articles/modify.asp...

rockywurden
01-10-2005, 06:23 PM
Robert
Thanks for the Help.
The following is a VB6 Subroutine that will change the MEDIA type to a CD-ROM.
NOTE:
TEXT3.TEXT has the name of the SETUPPROJECT.ISM
TEXT2.TEXT has the name of the RELEASE

Private Sub SetMSI()
'---------------------------------------------------------------------------------------
' Procedure : SetMSI
' DateTime : 1/10/2005 14:53
' Author :
' Purpose :
'---------------------------------------------------------------------------------------
'
Dim oMSI As Object
Dim oDB As Object
Dim oView As Object
Dim oRec As Object

On Error GoTo SetMSI_Error

Set oMSI = CreateObject("WindowsInstaller.Installer")

' open ISM file in transacted mode
Set oDB = oMSI.OpenDatabase(Text3.Text, 1)

Set oView = oDB.OpenView("SELECT * FROM `ISRelease` WHERE `ISRelease`='" & Text2.Text & "'") 'Get the release NAME

oView.Execute
Set oRec = oView.Fetch
'Set Property
oRec.stringdata(5) = "0" 'TYPE
oRec.stringdata(8) = "2" 'RELEASE TYPE
oRec.stringdata(13) = "650" 'DISK SIZE
oRec.stringdata(15) = "2048" 'DISK CLUSTER SIZE
oRec.stringdata(26) = "8988813" 'ATTRIBUTES


' update the changed record
oView.Modify 2, oRec

' close the view, commit changes, clean up
Set oRec = Nothing
oView.Close
oDB.Commit
Set oDB = Nothing
Set oMSI = Nothing


SetMSI_Error:
If Err.Number <> 0 Then MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure SetMSI of Form Form1"
Err.Clear
End Sub