Using the Registration API or Utility with XML

The recommended approach to register applications is to use the registration API or utility with XML.

First, you must create an XML document containing registration information and pass it to the registration API (see Creating the XML Registration Information). The most common scenario of application distribution is with a Windows Installer setup program (MSI) with a custom action that uses the RegisterMCEApp.exe utility. The Step-By-Step walkthrough and application templates help you create the necessary installers with a few additional steps.

The following are options for registering applications:

  • Using the Windows Installer XML Toolset (WiX), create a custom action for your Windows Installer 2.0-based setup program (MSI) to use the %windir%\ehome\RegisterMCEApp.exe utility.

  • From a command line, use the %windir%\ehome\RegisterMCEApp.exe utility.

    Using this utility results in a Success or Failure response at the command prompt. It also results in a return value of 0 to indicate success and non-zero to indicate failure. There is no prompt for the user in the Windows Media Center user interface.

  • Call the ApplicationContext.RegisterApplication method from within an already-installed application.

    The user is prompted with a confirmation dialog box because you cannot register your application on a client computer without permission, and this dialog box allows the user to cancel. The Add Link to Extras Library dialog box displays the source URL, not the destination URL. If the user accepts, the application entry points appear as specified in Windows Media Center.

You can verify that an entry point has been registered by using the ApplicationContext.IsEntryPointRegistered method. Verification is based on the ID (GUID) for the entry point.

Registering for All Users

You should register for All Users so that the application appears for any user of the Windows Media Center PC or on a connected Media Center Extender device. If you register without providing an instruction to register for All Users, the application will appear only for the user who completes the registration process.

To register for All Users by using the RegisterMCEApp.exe executable at the command line or by using an MSI custom action, include the /allusers switch. For example:

%windir%\ehome\registermceapp.exe /allusers myXMLFile.xml

The /allusers switch causes RegisterMceApp.exe to run as an administrator. In Windows Vista, a User Account Control dialog box prompt is displayed to the user.

If you are enabling users to register within your application using the ApplicationContext.RegisterApplication method, the All Users instruction is a Boolean parameter that you pass when you call the method. To register for All Users, set the allUsers parameter to true.

Registering from a Media Center Extender Session

Your application cannot be registered for All Users from a Media Center Extender session. When calling the RegisterApplication method, it is necessary for developers to treat Windows Media Center PC users and Media Center Extender users differently.

First, detect whether the user is using a Windows Media Center PC or a Media Center Extender. Then:

  • For users on the Windows Media Center PC, set the allUsers parameter to true.
  • On Media Center Extender devices, all User Account Control dialog boxes are automatically cancelled, so the Extender user cannot register for All Users. You should set the allUsers parameter to false, or the registration process will fail altogether. When your application is registered from the Extender, your shortcut will appear only to the Extender user.

Sample Explorer

  • ApplicationContext > InstallApplication
  • Web > Exception Handler

See Also