如何从Windows Media Center开始菜单中的自定义条带和磁贴启动可执行文件?

Ric*_*ard 11 windows windows-media-center

我在Windows Media Center中添加了自定义条带和磁贴.但是,当我选择磁贴时,我选择的应用程序(notepad.exe)不会启动,我收到以下错误:

[name]程序已停止响应,您将返回Windows Media Center.

我需要在XML中进行哪些更改才能 notepad.exe启动而不是显示此错误消息?


更多详情

使用此博客文章和Windows开发人员中心的此页面提供的示例,我创建了以下XML文件(称为dummy.xml):

<application title="appTitle" id="{81E3517C-A5F3-4afa-9E37-81BF9A6A99FE}">
    <entrypoint id="{760A3CF3-6675-444b-AA31-B2A3F94AD9A3}"
        addin="Microsoft.MediaCenter.Hosting.WebAddIn,Microsoft.MediaCenter"
        title="entrypointTitle"
        description="Description"
        run="notepad.exe">
        <category category="MyCompany\MyApplication1"/>
    </entrypoint>  
</application>
Run Code Online (Sandbox Code Playgroud)

和以下注册表文件(称为dummy.reg):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Start Menu\Applications\{81E3517C-A5F3-4afa-9E37-81BF9A6A99FE}]
"Title"="appTitle"
"Category"="MyCompany\\MyApplication1"
"OnStartMenu"="True"
"TimeStamp"=dword:0c7e59de
Run Code Online (Sandbox Code Playgroud)

然后我使用以下命令安装它们:

%windir%\ehome\registermceapp.exe dummy.xml
regedit.exe /s dummy.reg
Run Code Online (Sandbox Code Playgroud)

当我运行Windows Media Center时,我可以看到条带和磁贴 - 但是当我选择磁贴时,我收到一条错误消息:

[tile name]程序已停止响应,您将返回到Windows Media Center.

根据此页面,entrypoint元素具有以下属性run:

一个字符串,指定本地计算机上可执行文件的完整路径或相对路径.

我需要做什么不同的XML文件和注册表项notepad.exe才能运行,而不是显示错误消息?

Ric*_*ard 1

事实证明,问题是双重的:

  1. 没有正确阅读文档
  2. RegisterMceApp.exe即使 XML 不正确,也会报告“成功”。

这个记录该entrypoint元素的页面上,它非常清楚地指出:

<entrypoint
    id="entry point GUID"

    <!-- This element can have only one of the following attributes:
    addin="AssemblyInfo"
    url="URL of entry-point page"
    run="path of EXE file"
    -->
Run Code Online (Sandbox Code Playgroud)

我的 XML 文件同时使用了这两种addin方法,run这就是它不起作用的原因。

notepad.exe当从 Windows Media Center 中选择磁贴时,下面的更正版本(与原始注册表文件结合)将导致启动:

<application title="appTitle" id="{81E3517C-A5F3-4afa-9E37-81BF9A6A99FE}">
    <entrypoint id="{760A3CF3-6675-444b-AA31-B2A3F94AD9A3}"
        run="notepad.exe"
        title="entrypointTitle"
        description="Description">
        <category category="MyCompany\MyApplication1"/>
    </entrypoint>  
 </application>
Run Code Online (Sandbox Code Playgroud)