Share via


Retrieving a Client's Wrapper Playlist

banner art

Previous Next

Retrieving a Client's Wrapper Playlist

You can retrieve the wrapper playlist for a specific connected client by using code similar to the following examples.

Visual Basic .NET Example

Imports Microsoft.WindowsMediaServices.Interop
Imports interop_msxml

Private Sub ClientWrapper()

  ' Declare objects.
  Dim Server As WMSServer
  Dim WrapPlyLst As IWMSPlaylist

  Try
    ' Create a WMSServer object.
    Server = CreateObject("wmsserver.server")

    ' Retrieve the wrapper playlist object for the first 
    ' connected player.
    WrapPlyLst = Server.Players.Item(0).WrapperPlaylist

  Catch Err As Exception
    ' TODO: Exception handler goes here.

  Finally
    ' TODO: Clean-up code goes here.

  End Try

End Sub

C# Example

using Microsoft.WindowsMediaServices.Interop;
using interop_msxml;

// Declare variables.
WMSServer server;
IWMSPlaylist wrapper;

try
{
  // Create a new server object.
  server = new WMSServer();

  // Retrieve the wrapper playlist object for the first 
  // connected player.
  wrapper = server.Players[0].WrapperPlaylist;
}

catch(Exception)
{
  // TODO: Exception handler goes here.
}

finally
{
  // TODO: Clean-up code goes here.
}

C++ Example

// Include header files.
#include <windows.h>
#include "wmsserver.h"
#include <atlbase.h>    // Includes CComBSTR and CComVariant.

// Declare variables and interfaces.
IWMSServer      *pServer;
IWMSPlayers     *pPlayers;
IWMSPlayer      *pPlayer;
IWMSPlaylist    *pWrapper_Playlist;
CComVariant     varIndex;
HRESULT         hr;

// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
if (FAILED(hr)) goto EXIT;

hr = CoCreateInstance(CLSID_WMSServer,
                      NULL,
                      CLSCTX_ALL,
                      IID_IWMSServer,
                      (void **)&pServer);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the player collection.
hr = pServer->get_Players(&pPlayers);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the first connected player.
varIndex = 0;
hr = pPlayers->get_Item(varIndex, &pPlayer);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the wrapper playlist.
hr = pPlayer->get_WrapperPlaylist(&pWrapper_Playlist);
if (FAILED(hr)) goto EXIT;

EXIT:
  // TODO: Release temporary COM objects and uninitialize COM.

See Also (General)

See Also (Visual Basic .NET)

See Also (C#)

See Also (C++)

Previous Next