1

我的平台操作系统是 win 7。我开始编写扩展程序并尝试与 C++ 应用程序通信。这是我的应用程序的清单:(xxx 是我的扩展 ID)

{
  "name": "com.google.chrome.testc",
  "path": "D:\\testC\\debug\\testC.exe",
  "description": "My Application",
  "type": "stdio",
  "allowed_origins": [
  "chrome-extension://xxx/"
  ]
}

我还在以下位置添加注册表项:HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts: "com.google.chrome.testc: D:\testC\debug\manifest.json"

但是当扩展名为“chrome.runtime.sendNativeMessage('com.google.chrome.testc', ...)”时,它总是报告“找不到指定的本机消息传递主机。”。

我错过了哪一步?或者上面有什么问题?谢谢。

4

1 回答 1

4

注册表项应该是HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts\com.my_company.my_application,它的(Default)值应该是D:\testC\debug\manifest.json

根据您的描述,您似乎是com.my_company.my_application在键下添加了一个带有名称的字符串值HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts

于 2014-01-17T16:35:16.917 回答