久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 Electron 應用程序之外監聽鍵盤事件和鼠標移動

Listen for keyboard events and mouse movement outside of Electron app(在 Electron 應用程序之外監聽鍵盤事件和鼠標移動)
本文介紹了在 Electron 應用程序之外監聽鍵盤事件和鼠標移動的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我已經參與了幾個 Electron 項目,我正在嘗試弄清楚如何在應用程序處于后臺時偵聽任何按鍵或跟蹤鼠標移動.我正在使用 menubar 插件,所以應用程序仍在后臺運行.

I've been getting into a few Electron projects and I am trying to figure out how you could listen for any keypresses or and track mouse movement when the app is in the background. I am using the menubar plugin so the app is still running in the background.

我嘗試使用 global-shortcut API,但它看起來僅適用于快捷方式,您無法注冊單個按鍵.我還查看了 API,但尚未找到應用程序主屏幕之外的擊鍵和鼠標移動事件.

I tried using the global-shortcut API but it looks like that is for shortcuts only and you can't register individual keystrokes. I've also looked over the API and have yet to find an event for keystrokes and mouse movements outside the app's main screen.

推薦答案

這超出了電子應用程序的正常用例范圍.為了做到這一點,您需要開發一個本地模塊來調用操作系統的相應本地函數.

This is outside of the realm of normal use-cases for an electron application. In order to do this you would need to develop a native module that calls into the corresponding native functions of the operating system.

例如在 Windows 上:C++ Win32 鍵盤事件

For example on windows: C++ Win32 keyboard events

為節點制作原生插件:https://nodejs.org/api/addons.html

僅供參考,原生插件非常難.

FYI, Native addons are very hard.

這篇關于在 Electron 應用程序之外監聽鍵盤事件和鼠標移動的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to fix BrowserWindow is not a constructor error when creating child window in Electron renderer process(在 Electron 渲染器進程中創建子窗口時如何修復 BrowserWindow 不是構造函數錯誤) - IT屋-程序員軟件開發技術
mainWindow.loadURL(quot;https://localhost:3000/quot;) show white screen on Electron app(mainWindow.loadURL(https://localhost:3000/) 在 Electron 應用程序上顯示白屏)
Electron webContents executeJavaScript : Cannot execute script on second on loadURL(Electron webContents executeJavaScript:無法在第二個 loadURL 上執行腳本)
how to use electron browser window inside components in angular-cli?(如何在angular-cli的組件內使用電子瀏覽器窗口?)
ElectronJS - sharing redux store between windows?(ElectronJS - 在 Windows 之間共享 redux 存儲?)
How to access camera/webcamera inside electron app?(如何在電子應用程序中訪問相機/網絡攝像頭?)
主站蜘蛛池模板: 中文字幕欧美日韩一区 | 久久久夜 | 91超碰在线观看 | 91久久综合亚洲鲁鲁五月天 | 狠狠做深爱婷婷综合一区 | 国产高清在线视频 | 欧美久久久网站 | 一区二区精品视频 | 成人在线激情 | 欧美日韩国产一区二区三区 | 亚洲视频 欧美视频 | www.一区二区| 国内精品久久影院 | 日韩精品在线免费观看视频 | 久久精品国产精品青草 | 色综合天天综合网国产成人网 | 国产在线高清 | 久久精品二区亚洲w码 | 中文字幕在线网 | 国产精品久久久久久久久久久久 | 亚洲另类春色偷拍在线观看 | 九九九久久国产免费 | aa级毛片毛片免费观看久 | 在线国产精品一区 | 一区二区av | 玖玖玖av| 国产欧美精品一区二区色综合朱莉 | 亚洲国产精品一区 | www中文字幕 | 青青草av在线播放 | 国产这里只有精品 | 久久久999成人 | 亚洲视频在线播放 | 婷婷久久久久 | 丁香五月网久久综合 | 日韩av一二三区 | 成人在线精品 | 免费在线a视频 | 日韩字幕一区 | 亚洲精品一区二区三区在线 | 欧美一区免费 |