-4

I have this code in c#. But it does not run mp3 format file. Could you tell me what the error is in this code snippet:

WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();             
wplayer.URL = "D://j.mp3";             
wplayer.Controls.Play();

1 Answers1

1

A quick google search on your class name yeilds:

"To create the Windows Media Player control programmatically, you must first add a reference to wmp.dll, which is found in the \Windows\system32 folder. Adding this reference creates WMPLib.dll in your project folder, and a reference to WMPLib appears in Solution Explorer."

sourced from: Microsoft.

Robert H
  • 11,520
  • 18
  • 68
  • 110