Search code examples
c#quicktime

Determine quicktime version with C#


I am writing a C# application and I need to determine if quicktime is installed on the system and what version. This is on windows.


Solution

  • A quick Google search turned up the following code from this page:

    strComputer = "."
    
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    
    Set colItems = objWMIService.ExecQuery _
        ("Select * From Win32_Product Where Name = 'QuickTime'")
    
    If colItems.Count = 0 Then
        Wscript.Echo "QuickTime is not installed on this computer."
    Else
        For Each objItem in colItems
            Wscript.Echo "QuickTime version: " & objItem.Version
        Next
    End If
    

    "But wait!" you say, "That's VBScript, not C#!" That's true, but it's VBScript that does WMI queries. Another quick Google search turns up how to do WMI queries from C#.