Can I open a Windows 8 application with a URL?

我怕爱的太早我们不能终老 提交于 2019-12-03 00:36:36

You can do this easily & simply with a metro application by adding a special section to your manifest, and making sure you handle the correct activation type in your activation handler.

You can easily add to the manifest by using the VS Editor for the manfiest:

  • Open the manifest by double clicking on it on solution explorer
  • Select "Declarations" tab
  • Under "Available declarations" select protocol, and then click add
  • Set the name field to the protocol you want. e.g. "myawesomeapp" (this will give you urls like myawesomeapp://foo/bar/baz)

To handle this protocol you need to look for the activation kind "Protocol". This is in your activation handler, and on the "Kind" property. Full details on MSDN here (prog. lang. switch is in the top right) for both JavaScript & C#/C++/VB.

You can have your application install a protocol handler.

http://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx

http://msdn.microsoft.com/en-us/library/windows/desktop/bb266526(v=vs.85).aspx

Since your app must be installed on both computers, both would have the protocol handler installed.

A protocol handler allows you to define a new protocol name, similar to http: or ftp:, and have your application handle requests for that protocol. I once wrote one for Enterprise Architect that allowed users to share links to diagrams in projects using the format ea://MyProjectName?diagram=SomeDiagram.

You can check out that protocol handler here:

http://sourceforge.net/projects/eaprotocol/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!