IWMSClassObject.CreateInstance (C#)

banner art

Previous Next

IWMSClassObject.CreateInstance (C#)

The CreateInstance method is a generic method for creating objects for the server.

Syntax

  

Parameters

riid

Reference to a Guid specifying the requested object. This must be one of the following values.

Value Description
IID_IWMSContentDescriptionList GUID identifying an IWMSContentDescriptionList object.
IID_IWMSDataContainerVersion GUID identifying an IWMSDataContainerVersion object.
IID_IWMSPacket GUID identifying an IWMSPacket object.
IID_IWMSPacketList GUID identifying an IWMSPacketList object.
IID_IWMSStreamHeader GUID identifying an IWMSStreamHeader object.
IID_IWMSStreamHeaderList GUID identifying an IWMSStreamHeaderList object.

ppunk

Reference to an IntPtr containing a newly created object.

Return Values

This method does not return a value.

If this method fails, it throws an exception.

Number Description
0x80070057 ppunk is null or riid is not equal to one of the expected values.
0x8007000E There is insufficient memory to complete the function.

Example Code

Guid ContentDescListGuid = typeof(IWMSContentDescriptionList).GUID;
IWMSContentDescriptionList  ContentDescList;
IntPtr                      pUnknown;
            
try
{
    m_ClassFactory.CreateInstance(ref ContentDescListGuid, out pUnknown);
    ContentDescList =
            (IWMSContentDescriptionList)Marshal.GetTypedObjectForIUnknown(
                            pUnknown, typeof(IWMSContentDescriptionList));
}
catch( Exception e )
{
    // TODO: Handle exceptions.
}

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.

See Also

Previous Next