none
windows media player contoll in c# RRS feed

回答

  • 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
    2009年2月22日 12:33
  • 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
    2009年2月26日 2:46
  • 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).aspx

    The 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).aspx

    Hope this helps.

    Sincerely,
    Linda Liu

     

     

    • 回答としてマーク sameden2 2009年2月27日 19:56
    2009年2月27日 4:40

すべての返信

  • 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
    2009年2月20日 11:13
  • sorry


    it just doesnt work no megs nothing i think the code is wonge

    sam eden
    2009年2月20日 14:10
  • ..and i think it doent work because it wood work for something ealsjust not the wmp controll
    2009年2月20日 14:32
  • 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
    2009年2月22日 12:33
  • wht i relly need it to do is open a open file dialog then open a file and play it can u help

    sam eden

    try SAIO v1.0 beta go to sites.google.com/site/sameden2
    2009年2月24日 16:26
  • Use the OpenFileDialog classto prompt for a file. Then once you get a filename set the URL property.

    http://blog.voidnish.com
    2009年2月24日 16:34
    モデレータ
  • sorry im a bit dumb do u have some code i could try

    sam eden

    try SAIO v1.0 beta go to sites.google.com/site/sameden2
    2009年2月25日 18:29
  • 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
    2009年2月26日 2:46
  • thaks that worked

    sam eden

    try SAIO v1.0 beta go to sites.google.com/site/sameden2
    2009年2月26日 17:21
  • just to add to my wmp app

    has anyone got any code so i could loop the track that is playing

    sam eden

    try SAIO v1.0 beta go to sites.google.com/site/sameden2
    2009年2月26日 17:28
  • 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).aspx

    The 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).aspx

    Hope this helps.

    Sincerely,
    Linda Liu

     

     

    • 回答としてマーク sameden2 2009年2月27日 19:56
    2009年2月27日 4:40
  • thanks so much 
    it works now my app is 1 line of code better lol

    sam eden

    btw is anyone wont to try the beta for my app use the link below

    try SAIO v1.0 beta go to sites.google.com/site/sameden2
    2009年2月27日 19:54