Mailbag: How to programatically enumerate installed Media Center applications


Question:

I would like to write an application that provides shortcuts to all registered Windows Media Center applications and entry points on the system to allow users to launch them more easily.  How can I reliably obtain a list of registered Media Center applications on a system and then launch the applications when a user chooses the shortcuts?

Answer:

You can use the following algorithm to enumerate all registered Windows Media Center applications and entry points and then launch an entry point within Media Center:

  1. Call the IExtensibilityApplications::GetFilteredEntryPoints API described at http://msdn2.microsoft.com/en-us/library/aa468392.aspx to get a list of all registered entry points.  There is a note in this documentation stating that you have to pass in a category name to filter against, but that note is not accurate. If you pass null for strCategory (but not an empty string), it will match all entry points in all categories
  2. Use the returned list from the GetFilteredEntryPoints API to create a list of shortcuts in your application UI
  3. When the user clicks on an entry point link in your application UI, use the MediaCenterEnvironment.LaunchEntryPoint method described at http://msdn2.microsoft.com/en-us/library/bb189321.aspx to launch the entry point.  Make sure to not use the IExtensibilityApplications::LaunchEntryPoint method because that will cause Media Center to launch the entry point in an alternative shell application instead of in Media Center itself.

One additional note here - in the documentation for IExtensibilityApplications::GetFilteredEntryPoints at http://msdn2.microsoft.com/en-us/library/aa468392.aspx, there is a Remarks section that states the following:

"If a category is not specified in strCategory, results will not be returned in pRetVal."

This remark is not accurate.  This API supports both of the following:

  • Passing null as the value for strCategory - doing this will cause this method to return a list of entry points registered in all categories instead of in a specific category
  • Passing a category substring - doing this will cause the method to return a list of entry points registered in categories that contain the substring.  The substring must be delimited by a backslash that represents a registry sub-key.  For example, you cannot pass in "back" to match applications registered in the Background category, but you can pass in "Services" to match all applications registered in any of the Services categories.
Comments (2)

  1. ryan_hurst says:

    Aaron, what if you want to enumerate running add-ins.

    For example today I started writing a add-in that allowed you to invoke a add-in based on a ir-sequence and I dont want to invoke multiple copies of the add-in instead I want to detect if a instance is running then bring that one to the top.

    Thing is it may have been invoked by someone other than me so I need to enumerate running add ins, get a handle to them so I can bring to the top.

    Ideas?

  2. Hi Ryan_hurst – There is not a way to programatically tell whether or not another instance of an add-in is already running.

    There is a way that an add-in can prevent multiple instances of itself from being launched.  This is described at http://msdn2.microsoft.com/en-us/library/bb189474.aspx.  However, this mechanism relies on the add-in developer to code this logic into their add-in.

Skip to main content