Share via


IWMSServer.MonikerName (C#)

banner art

Previous Next

IWMSServer.MonikerName (C#)

The MonikerName property retrieves the moniker display name that can be used to create and initialize a IWMSServer object.

Syntax

  string = IWMSServer.MonikerName;

Property Value

A string containing the display name.

If this property fails, it throws an exception.

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

Remarks

This property is read-only. A moniker is a persistent COM component that encapsulates both the ability to locate an object or data and to retrieve that object or data into memory. The display name can be used to create the object.

This example appears circuitous because it uses an IWMSServer method to create an IWMSServer object by using the moniker. Typically, monikers are used because marshaling interface pointers consume more resources. Use a moniker if you are not sure that the client needs an interface pointer. Marshaling overhead is incurred only if the client binds to the moniker.

Example Code

using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer   Server, MonikerServer;
string      Moniker;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve the file type for the specified file.
    Moniker = Server.MonikerName;

    // Create an object by using the moniker name, and unbox it
    // by making the appropriate explicit cast.
    MonikerServer = (WMSServer)Marshal.BindToMoniker(Moniker);

    // Verify that the moniker created a WMSServer object.
    MessageBox.Show(MonikerServer.Name);
    MessageBox.Show(Server.Name);
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
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 family, Windows Server 2008 family.

See Also

Previous Next