Partager via


IWMSClassObject.AllocIWMSContext (Visual Basic .NET)

The AllocIWMSContext method allocates an IWMSContextIWMSContext Object (Visual Basic .NET).

IWMSClassObject.AllocIWMSContext(  ByRef riid As Guid,
  ContextType As WMS_CONTEXT_TYPE,
  pRelatedContext As Object,
  ByRef ppunk As IntPtr
)

Arguments

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

A 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

Dim Context As IWMSContext
Dim pUnknown As IntPtr

Try
    m_ClassFactory.AllocIWMSContext( _
                                 GetType(IWMSContext).GUID, _
                                 WMS_CONTEXT_TYPE.WMS_USER_CONTEXT_TYPE, _
                                 pUserContext, pUnknown)
    Context = Marshal.GetTypedObjectForIUnknown(pUnknown, _
                                                GetType(IWMSContext))

Catch e As Exception
    ' TODO: Handle exceptions.
End Try

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 (Visual Basic .NET)