displaying embedded cover art in wma file

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Frank Peters (frankpeters_at_msn.com)
Date: 09/20/04


Date: Mon, 20 Sep 2004 21:03:43 GMT

I am getting a runtime error trying to retrieve the WM/Picture metadata
from my test wma file.

ERROR when executing: pic = media.getItemInfoByType("WM/Picture", "", 0)

An unhandled exception of type 'System.ArgumentException' occurred in
WindowsApplication2.exe
Additional information: The parameter is incorrect.

Here is a snippet from my code

Any help would be greatly appreciated

Imports WMPLib.WindowsMediaPlayerClass

Public Class Form1
     Inherits System.Windows.Forms.Form
     Dim AlbumName As String
     Dim ArtistName As String
     Dim SongName As String
     Dim Path As String
     Dim WithEvents mplayer As WMPLib.WindowsMediaPlayer

     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

         mplayer = New WMPLib.WindowsMediaPlayer
         mplayer.URL = Path.Text
         mplayer.controls.play()

         Dim media As WMPLib.IWMPMedia3
         media = mplayer.newMedia(Path.Text)

** These calls succeed **
         AlbumName.Text = media.getItemInfo("WM/AlbumTitle")
         ArtistName.Text = media.getItemInfo("Author")
         SongName.Text = media.getItemInfoByType("Title", "", 0)

         Dim pic As WMPLib.IWMPMetadataPicture
** The following call causes the error:
System.ArgumentException
The parameter is incorrect.
**
         pic = media.getItemInfoByType("WM/Picture", "", 0)


Quantcast