久久久久久久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 | 夜夜爽99久久国产综合精品女不卡 | 成人欧美一区二区 | 国产日韩欧美一区二区 | 国产精品一区一区 | 久久久久国产一区二区三区四区 | 免费一区二区 | 精品久久一区 | 亚洲一区二区三区免费在线观看 | 亚州综合一区 | 久久这里只有 | 日本aa毛片a级毛片免费观看 | 第一福利社区1024 | 草比网站 | 欧美不卡视频 | 午夜精品久久久久久久久久久久 | 男人电影天堂 | 国产一区二区欧美 | 欧美网站一区二区 | 亚洲成人午夜在线 | 久久av一区 | 四虎永久免费影院 | 国产激情一区二区三区 | 精品欧美一区二区精品久久久 | 中文字幕一区二区三区四区五区 | 国产精品久久久久久久久久久免费看 | 亚洲bt 欧美bt 日本bt | 一级毛片观看 | 黄一区二区三区 | 中文字幕视频三区 | 免费看a | 在线观看不卡av | 精品一区在线免费观看 | 日韩精品在线一区二区 | 欧美一级二级三级 | 国产精品亚洲一区二区三区在线 | 日韩中文字幕一区二区三区 | 亚洲国产一区二区在线 | 精品一区国产 | 欧美v免费| www.夜夜草|