IWMSClassObject.AllocIWMSCommandContext (C#)

The AllocIWMSCommandContext method allocates an IWMSCommandContextIWMSCommandContext Object (C#).

void IWMSClassObject.AllocIWMSCommandContext(
  ref Guid riid,
  object pRelatedContext,
  out IntPtr ppunk


Reference to a Guid containing the data structure IID. This must be equal to IID_IWMSCommandContext.

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

Reference to an IntPtr containing an IWMSCommandContext object.

Return Value

This method does not return a value.

If this method fails, it throws an exception.




ppunk is null.


There is insufficient memory to complete the function.


The pRelatedContext parameter contains an IWMSCommandContext object. A command context contains requests by the client and responses by the server. To increase performance, the server can share critical sections between command contexts Each plug-in is passed the user context to create a component per user (client/data path). This user context should be passed as the pRelatedContext so they can share critical sections.


Guid ContextGuid = typeof(IWMSCommandContext).GUID;
IWMSCommandContext  CmdContext;
IWMSContext         CmdRequest;
IntPtr              pUnknown;
    m_ClassFactory.AllocIWMSCommandContext(ref ContextGuid, pUserContext,
                                           out pUnknown);
    CmdContext = (IWMSCommandContext)Marshal.GetTypedObjectForIUnknown(
                                    pUnknown, typeof(IWMSCommandContext));
    CmdContext.GetCommandRequest(out CmdRequest);
catch( Exception e )
    // TODO: Handle exceptions.


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


IWMSClassObject Object (C#)