【问题标题】:Set browserWindow Always on top, Even if Other Apps/Games are in fullscreen [Electron, Windows OS]设置 browserWindow 始终在顶部,即使其他应用程序/游戏全屏 [Electron,Windows 操作系统]
【发布时间】:2021-12-31 03:44:44
【问题描述】:

我如何让我的电子应用程序位于处于全屏模式的其他应用程序或游戏之上,例如 Windows 上的叠加层。

这个mainWindow.setAlwaysOnTop(true, "level"); 适用于大多数应用程序。

https://www.electronjs.org/docs/latest/api/browser-window

我检查了电子文档并尝试了所有不同的“关卡”,但它们都不能在全屏游戏中使用。

代码:

  // Create the browser window.
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
  });

  // and load the index.html of the app.
  mainWindow.loadFile(path.join(__dirname, 'index.html'));

  mainWindow.setAlwaysOnTop(true, "level");


  // Open the DevTools.
  // mainWindow.webContents.openDevTools();
};

我目前正在英雄联盟中对此进行测试。 将视频设置更改为无边框,窗口显示,但更改为全屏,电子窗口不再位于最前面。

我知道这是可能的,因为 Discord(用电子制作)有一个覆盖层,在设置为全屏的游戏中显示。

【问题讨论】:

  • 在这种情况下,单词很重要,因为文档说:“alwaysOnTop Boolean (optional) - 窗口是否应该始终位于其他窗口的顶部。默认值为 false。”。请注意那里的“窗口”一词,因为全屏应用程序不是窗口化的。它们是全屏的。

标签: javascript windows electron


【解决方案1】:

在 electron.js 中无法使用叠加层,因为它只与标准 win32 api 交互。

如果我没记错的话,discord 使用一个单独的、较低级别的应用程序来覆盖它们。

【讨论】:

  • 任何线索他们使用哪个较低级别的应用程序或库与之交互?努力寻找有关它的任何信息
猜你喜欢
  • 2017-02-11
  • 1970-01-01
  • 2020-05-29
  • 1970-01-01
  • 2016-11-24
  • 1970-01-01
  • 2015-03-20
  • 1970-01-01
  • 2014-01-14
相关资源
最近更新 更多