トップ回答者
windows media player contoll in c#

質問
回答
-
Hi Sameden2,
>i have added a wmp to my form but i cant get it to open a file to play
Set the URL property of the WMP ActiveX control to the path of the file to play. For example:
this.axWindowsMediaPlayer1.URL = "file path";
In addition, if you want to stop playing the file, simply set the URL property to an empty string or call the close method of the WMP control:
this.axWindowsMediaPlayer1.URL = "";
-or-
this.axWindowsMediaPlayer1.close();
Hope this helps.
If you have any question, please feel free to let me know.
Sincerely,
Linda Liu- 回答としてマーク Linda Liu 2009年2月24日 2:35
-
Hi Sam,
The following is the sample code to open a file and play it using Windows Media Player:
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
{
this.axWindowsMediaPlayer1.URL = ofd.FileName;
}
Hope this helps.
If you have anything unclear, please feel free to let me know.
Sincerely,
Linda Liu- 回答としてマーク sameden2 2009年2月26日 17:21
-
Hi Sam,
Use the following line of code to loop the track that is playing in WMP:
(this.axWindowsMediaPlayer1.settings as WMPLib.IWMPSettings).setMode("loop", true);
For more information on IWMPSettings.setMode method, refer to the following document:
"IWMPSettings.setMode (VB and C#)"
http://msdn.microsoft.com/en-us/library/bb262592(VS.85).aspxThe following document introduces using WMP in .NET applications, which may be helpful to you:Using "the Windows Media Player Control in a .NET Framework Solution"
http://msdn.microsoft.com/en-us/library/bb248593(VS.85).aspxHope this helps.
Sincerely,
Linda Liu- 回答としてマーク sameden2 2009年2月27日 19:56
すべての返信
-
try to be a little more elaborate. e.g.: do you get an error message? an exception? a compiler error?
WM_THX
-thomas woelfer
http://www.die.de/blog -
Hi Sameden2,
>i have added a wmp to my form but i cant get it to open a file to play
Set the URL property of the WMP ActiveX control to the path of the file to play. For example:
this.axWindowsMediaPlayer1.URL = "file path";
In addition, if you want to stop playing the file, simply set the URL property to an empty string or call the close method of the WMP control:
this.axWindowsMediaPlayer1.URL = "";
-or-
this.axWindowsMediaPlayer1.close();
Hope this helps.
If you have any question, please feel free to let me know.
Sincerely,
Linda Liu- 回答としてマーク Linda Liu 2009年2月24日 2:35
-
Hi Sam,
The following is the sample code to open a file and play it using Windows Media Player:
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
{
this.axWindowsMediaPlayer1.URL = ofd.FileName;
}
Hope this helps.
If you have anything unclear, please feel free to let me know.
Sincerely,
Linda Liu- 回答としてマーク sameden2 2009年2月26日 17:21
-
Hi Sam,
Use the following line of code to loop the track that is playing in WMP:
(this.axWindowsMediaPlayer1.settings as WMPLib.IWMPSettings).setMode("loop", true);
For more information on IWMPSettings.setMode method, refer to the following document:
"IWMPSettings.setMode (VB and C#)"
http://msdn.microsoft.com/en-us/library/bb262592(VS.85).aspxThe following document introduces using WMP in .NET applications, which may be helpful to you:Using "the Windows Media Player Control in a .NET Framework Solution"
http://msdn.microsoft.com/en-us/library/bb248593(VS.85).aspxHope this helps.
Sincerely,
Linda Liu- 回答としてマーク sameden2 2009年2月27日 19:56