IWMSClassObject.AllocIWMSContext (C#)

banner art

Previous Next

IWMSClassObject.AllocIWMSContext (C#)

The AllocIWMSContext method allocates an IWMSContext object.

Syntax

  

Parameters

riid

Reference to a Guid specifying the data structure IID. This must be equal to IID_IWMSContext.

ContextType

WMS_CONTEXT_TYPE enumeration value specifying the context type that is allowed.

pRelatedContext

object containing a context object. This object can be null.

ppunk

Reference to an IntPtr containing a newly created IWMSContext object.

Return Values

This method does not return a value.

If this method fails, it throws an exception.

Number Description
0x80070057 ppunk is null.
0x8007000E There is insufficient memory to complete the function.

Remarks

The pRelatedContext parameter contains an IWMSContext object. For performance reasons, the server might share critical sections between contexts.

Example Code

Guid ContextGuid = typeof(IWMSContext).GUID;
IWMSContext         Context;
IntPtr              pUnknown;
            
try
{
    m_ClassFactory.AllocIWMSContext(ref ContextGuid,
                                   WMS_CONTEXT_TYPE.WMS_USER_CONTEXT_TYPE,
                                   pUserContext, out pUnknown);
    Context = (IWMSContext)Marshal.GetTypedObjectForIUnknown(pUnknown,
                                                     typeof(IWMSContext));
}
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