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?
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:
- 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
- Use the returned list from the GetFilteredEntryPoints API to create a list of shortcuts in your application UI
- 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.