How to check what version of Windows Media Player is installed on the machine?
Asked Answered
H

3

2

As far as I know Windows Media Player 10 is the minimum requirement for WPF MediaElement to work. What is a decent way to programmatically (from .NET) check if WMP is present, and its version?

Halfandhalf answered 15/9, 2010 at 13:38 Comment(0)
C
3

The method I used in my installer is to check this registry value:

HKLM
Software\Microsoft\MediaPlayer\PlayerUpgrade
PlayerVersion

The PlayerVersion value will be set to a string like "10,0,0,0". (Note that commas, not periods, are used to separate the numbers.) You need to extract the first number (the major version) and make sure that it is 10 or higher.

I couldn't find any official documentation about how to detect WMP, but the above method seems to work properly with the current versions of Windows and WMP.

Note that if WMP9 (the version that ships with Windows XP) is installed, your application will not crash when you try to use a MediaElement, but the control won't render anything, and warning messages will be printed to the debugger.

If your application will only be used with Vista or higher, you don't need to worry about any of this, because Vista comes with WMP10.

Cracked answered 16/9, 2010 at 3:5 Comment(2)
If i need to check windows media player 9 is installed in Xp, as well as Windows 7 & Vista, How can I do that ?Verdugo
Specified key is not working in windows 7 to get the media player versionVerdugo
P
2

Here's how you can check all the products installed on the system:

SelectQuery allProductsQuery = new SelectQuery("Win32_Product");

ManagementObjectSearcher allProducts =
new ManagementObjectSearcher(allProductsQuery);

foreach(ManagementObject product in allProducts.Get())
{
Console.WriteLine("Product {0} is at version {1}",
product.Properties["Name"].Value,
product.Properties["Version"].Value);
}

You need to add "using System.Management" and a reference to "System.Management.dll".

To get informations for a specific product you can refine the query or search the product within all of them.

Pomegranate answered 15/9, 2010 at 13:49 Comment(1)
allProducts.Get() call takes quite a long time to run. Also, Windows Media player doesn't seem to be in the Win32_Product WMI class, because it is a windows component and is not installed via Windows Installer.Halfandhalf
C
0

i found this solution:

FileVersionInfo inf = FileVersionInfo.GetVersionInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Windows Media Player", "wmplayer.exe"));
        if (inf.FileVersion.StartsWith("9"))
        {...
Creosol answered 28/12, 2012 at 6:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.