简体   繁体   English

在Windows上:如何使用上下文菜单中的“使用...打开”命令正确打开文件?

[英]On Windows: How to open file with “Open with…” command in context menu correctly?

When I use the context menu command "Open with..." within Windows 7, the OS opens a new instance of my Electron application. 当我在Windows 7中使用上下文菜单命令“使用...打开”时,操作系统将打开我的Electron应用程序的新实例。 I would prefer, that if the application is already running, the file to be opened will be opened within the already opened instance and not in a new one. 我希望,如果应用程序已经在运行,则要打开的文件将在已打开的实例中打开,而不是在新实例中打开。

How can I achieve that? 我该如何实现?

使用app.makeSingleInstance()函数,文档中有一个示例。

I think this doesn't depend on windows (like open with settings) & it's a application specific setting (if exists). 我认为这不依赖于Windows(例如使用设置打开),而是特定于应用程序的设置(如果存在)。 I did a little search and found this link, maybe useful ;) https://www.npmjs.com/package/electron-single-instance 我做了一些搜索,发现此链接可能有用;) https://www.npmjs.com/package/electron-single-instance

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM