C
C#5mo ago
nullptr

get current windows media player info (playing or paused, current song url, etc) from a .NET app?

hello! the title really says it all, i want to be able to read the state of windows media player from c#. is that possible?
3 Replies
Lex Li
Lex Li5mo ago
Even if that was possible, no one really should use Windows Media Player right now, https://stackoverflow.com/questions/56478/how-to-interact-with-windows-media-player-in-c-sharp There are so many modern media players out there, and some of them makes automation rather simple.
kpang5812
kpang58125mo ago
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Process WHERE Name='wmplayer.exe'");

// Iterate through the collection of running processes
foreach (ManagementObject process in searcher.Get())
{
// Get process ID and other properties
string processId = process["ProcessId"].ToString();
string processName = process["Name"].ToString();
}
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Process WHERE Name='wmplayer.exe'");

// Iterate through the collection of running processes
foreach (ManagementObject process in searcher.Get())
{
// Get process ID and other properties
string processId = process["ProcessId"].ToString();
string processName = process["Name"].ToString();
}
You can get info of current running media player like above For other media players like VLC or iTunes, you'll need to explore their respective APIs and libraries to control playback programmatically. These media players often provide APIs for remote control or integration with other applications.
nullptr
nullptr5mo ago
and this is a program im writing for myself, and i use WMP lol