C# How to access the current playback of windows

老子叫甜甜 提交于 2020-04-11 18:37:54

问题


at Windows 10 there is a Music Feature(Pic Below):

So my Question is: How can I access this information with C# and which libraries do i need?

Thanks for helping


回答1:


Excuse me for my ignorance, but if I am correct, this widget is a pop up of Spotify, isn't this? In that case, you only have to check the MainWindowsTitle of spotify process.

        var spotify = Process.GetProcessesByName("Spotify");
        foreach (var song in spotify)
        {
            Console.WriteLine(song.MainWindowTitle);
        }

        Console.ReadLine();

Don't forget use using System.Diagnostics;. You will have to check if you don't get any song.

I was checking if this method works yet :)



来源:https://stackoverflow.com/questions/44526944/c-sharp-how-to-access-the-current-playback-of-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!