다음을 통해 공유


IWMPMedia.isIdentical (VB and C#)

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The isIdentical property (the get_isIdentical method in C#) gets a value indicating whether the specified media item is the same as the current one.

[Visual Basic]
ReadOnly Property isIdentical(
  pIWMPMedia As IWMPMedia
) As System.Boolean
[C#]
System.Boolean get_isIdentical (
  IWMPMedia pIWMPMedia
);

Parameters

pIWMPMedia

A WMPLib.IWMPMedia interface to the media item to be compared with the current media item.

Property Value

A System.Boolean value that indicates whether the two media items are identical.

Remarks

IWMPMedia.isIdentical is a property in Visual Basic that takes a parameter. In C# it is referred to as the IWMPMedia.get_isIdentical method.

Examples

The following example uses the isIdentical property (the get_isIdentical method in C#) to check whether a media item named newMedia is the same as the current media item. If they are not the same, the new media item is played. Otherwise, the current media continues to play uninterrupted. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

if (newMedia.get_isIdentical(player.currentMedia) != true)
{
    // Change the current media to the new media item.
    player.currentMedia = newMedia;

    // Play the new media item.
    player.Ctlcontrols.play();
}

If (newMedia.isIdentical(player.currentMedia) <> True) Then

    &#39; Change the current media to the new media item.
    player.currentMedia = newMedia

    &#39; Play the new media item.
    player.Ctlcontrols.play()

End If

Requirements

Requirement Value
Version
Windows Media Player 9 Series or later
Namespace
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

See also

IWMPMedia Interface (VB and C#)