简体   繁体   English

单击MP3文件时打开媒体播放器

[英]Open media player when clicked on an MP3 file

How to develop a media player which opens up and plays song when an MP3 file is opened. 如何开发一种媒体播放器,该媒体播放器在打开MP3文件时可以打开并播放歌曲。 Just like in our OS when you click on MP3 file Windows media player opens up and plays song. 就像在我们的操作系统中一样,当您单击MP3文件时,Windows Media Player会打开并播放歌曲。

In my application how to handle this functionality. 在我的应用程序中如何处理此功能。

To open your app when double clicking on a mp3: use the registry or "Right click mp3, open with, and select your application" 要在双击mp3时打开您的应用,请执行以下操作:使用注册表或“右键单击mp3,打开方式,然后选择您的应用”

To play the MP3 in your app: You will get the filepath as the first parameter of your 'main' function. 在您的应用程序中播放MP3:您将获得文件路径作为“ main”功能的第一个参数。

class Program
{
    static void Main(string[] args)
    {
       if (args != null)
       {
         String filePath = args[0];
         SomeForm frm = new SomeForm(filePath );
       }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM