ltmmWMProfileManager.SystemProfileVersion Example for Visual Basic
' Demo for enumerating system profiles and displaying profile info
Sub BuildSystemProfileList()
Dim manager As ltmmWMProfileManager
Dim profile As ltmmWMProfile
' create the profile manager
Set manager = New ltmmWMProfileManager
' set the version to show Windows Media 8.0 system profiles
manager.SystemProfileVersion = ltmmWMT_VER_8_0
' walk the list of system profiles and add the name to the combo box
cmbSysProfiles.Clear
For i = 0 To (manager.SystemProfileCount - 1)
Set profile = manager.LoadSystemProfile (i)
cmbSysProfiles.AddItem profile.Name
Next
End Sub
Function LoadSystemProfile(profileid As String) As ltmmWMProfile
Dim manager As ltmmWMProfileManager
Dim profile As ltmmWMProfile
' create the profile manager
Set manager = New ltmmWMProfileManager
' set the version to load Windows Media 8.0 system profiles
manager.SystemProfileVersion = ltmmWMT_VER_8_0
' load the the specified profile
' the property causes the following error :
' No matching element is found in the list.%0
Set LoadSystemProfile = manager.LoadProfileByID (profileid)
End Function
Function ProfileToString(profile As ltmmWMProfile) As String
Dim manager As ltmmWMProfileManager
' create the profile manager
Set manager = New ltmmWMProfileManager
' convert the profile to string
ProfileToString = manager.SaveProfile (profile)
End Function
Function ProfileFromString(profilestr As String) As ltmmWMProfile
Dim manager As ltmmWMProfileManager
' create the profile manager
Set manager = New ltmmWMProfileManager
' load profile from string data
Set ProfileFromString = manager.LoadProfileByData (profilestr)
End Function
Private Sub Form_Load()
Dim profile As ltmmWMProfile
Dim s As String
BuildSystemProfileList
' load a system profile
Set profile = LoadSystemProfile("{BBC75500-33D2-4466-B86B-122B201CC9AE}")
' convert to string
s = ProfileToString(profile)
' display the string
If profile.Version = ltmmWMT_VER_4_0 Then
MsgBox "Profile " + profile.Name + " Content : " + s + "This profile contains " + CStr(profile.StreamCount) + " streams and " + CStr(profile.MutualExclusionCount) + " mutex"
End If
' convert string to profile
Set profile = ProfileFromString(s)
End Sub