wilix-team / iohook

Node.js global keyboard and mouse listener.
https://wilix-team.github.io/iohook
MIT License
1.2k stars 291 forks source link

Drops of events in windows #238

Open hmake98 opened 4 years ago

hmake98 commented 4 years ago

Iohook stopped in windows platform.

The scenario in detail: Iohook is supported with electron js environment. But somehow It's not working in windows platform with the use of electron js. It's dropping events sometimes with random behavior. I tried to install VC_redistx64.exe. But, It'll fix the issue for a temporary basis.

Here's my environment detail:

Djiit commented 4 years ago

Hey, thanks for opening an issue. Could you provide a minimum reproducible example ?

hmake98 commented 4 years ago

Hey @Djiit, I can share a demo. But, there is a random behavior. and major of this issue we're facing is in windows system.

xudaolong commented 4 years ago

@Djiit I also found this problem. When I listen to keydown/keyup, sometimes I can't get events. Only in windows os.

ape-casear commented 4 years ago

In my case, I saw some users's windows will drop events or trigger wrong events. I think all due to the protect software which in user's pc.

vovazubko commented 3 years ago

Maybe it could help. If electron run on user right, but you make active an application's window with admin right (right mouse click run as administrator). You couldn't get events.

TLeaves commented 3 years ago

I think i had found the reason! libuiohook listen a event names EVENT_OBJECT_NAMECHANGE on windows. when the event is triggered, libuiohook will unhook all listener and rehook it.

when the event emited after unhook and before rehook, it will lost!

I am try to remove the code of SetWinEventHook on EVENT_OBJECT_NAMECHANGE. it looks good!

I found the commit of this changed on it: https://github.com/kwhat/libuiohook/pull/14

ash0x0 commented 3 years ago

Is it currently an issue or was it fixed? Is it something that was resolved upstream?

hmake98 commented 3 years ago

@ash0x0 Yes, It's still coming up in the windows system.

ash0x0 commented 3 years ago

@ash0x0 Yes, It's still coming up in the windows system.

Is there a pattern to this that you noticed or is it completely random? I haven't been able to repro, does it happen after some time or right away? With certain applications or after certain events?

hmake98 commented 3 years ago

@ash0x0 It's completely random. It's most probably occurs when the app is freshly installed into the system.

TLeaves commented 3 years ago

I had fixed this bug on my repo. But it is a temporary modification because only remove the logic of SetWinEventHook. I think it's a better way to do a configuration. But I am not familiar with this. If you know how to do, please tell me.

https://github.com/TLeaves/iohook/commit/226ce6c27243337075050002b641c13232077d96