Share via


IWMSClassObject.AllocIWMSContext (C#)

The AllocIWMSContext method allocates an IWMSContextIWMSContext Object (C#).

void IWMSClassObject.AllocIWMSContext(
  ref Guid riid,
  WMS_CONTEXT_TYPE ContextType,
  object pRelatedContext,
  out IntPtr ppunk
);

Arguments

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

WMS_CONTEXT_TYPE enumeration value specifying the context type that is allowed.

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

Reference to an IntPtr containing a newly created IWMSContext object.

Return Value

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

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

Concepts

IWMSClassObject Object (C#)