python - teamplayer and pyhook interacting strangely -


I am using, so that you can simultaneously use more rats on my computer, I also use pyHook To capture the events of the mouse, with the following code:

  import pyHook import pythoncom def onclick (event): # When mouse events are receiving printed 'MessageName:' It is said, event. Message 'print message:', event. Message Print 'Time:', Event Time Print 'WindowName:', Event. Windows print 'Status:', Event. The print of the post '---' back right hm = pyHook HookManager () hm.MouseLeftDown = onclick hm.MouseLeftUp = onclick hm.HookMouse () pythoncom.PumpMessages ()  

without code teamplayer Works fine - it detects the mouse button on top and bottom correctly. If I run the program then the team player starts, so it continues to work well, this time the exact click is being detected from both rats.

However, if I start the after team player program starts, then every mouseclick gets double:

  MessageName: Mouse Quoted message: 513 Time: 7231317 Window name: Any status: (673, 367) --- Message Name: Mouse left message: 513 Time: 7231317 WindowName: None Status: (673, 367) - - MessageName: Mouse left message: 514 Time: 7,231,379 WindowName: None Status: (673, 367) --- MessageName: Mouse left message: 514 Time: 7231379 Window name: None Reaction: (673, 367)  

It would be fine - I can detect clicks with the same timestamp, and to ignore the other. However, when I click with a different mouse, the pattern is odd:

  MessageName: left mouse button left: 513 Time: 7,305,916 WindowName: C: \ Python25 \ python.exe Status: (569 306) --- MessageName: left mouse button left: 513 time: 7,305,916 WindowName: C: \ Python25 \ python.exe status: (722, 365) --- MessageName: left mouse message: 514 time: 7,309,598 WindowName: C: \ Python25 \ python.exe Status: (722, 365) --- MessageName: mouse left message: 514 Time: 7,309,598 WindowName: C: \ Python25 \ python.exe Status: (722, 365)  

That is, the event below is the last event. Uses the coordinates! The problem is also that the wrong incidence is first, which is having trouble finding the right (I can just say "do not ignore the first incident", because if the team player is closed or only a mouse is connected, then this is the only one Is!)

Any ideas as to why this can happen, and what can I do to get normal mouse events?

Multiple Considerations:

  • Find duplicate clicks from the same timestamp And ignore the first of them, it requires a delay in processing, unless it ticks in a while that complicates the minor cases in your code ...
  • You Instead, you can change the pyhook source to handle duplicates; Debugging within your source code can give you more information about what is happening. By looking at this, you can do this in your hook manager / <> code signature and flush messages by looking at it. Once you have worked, you can wrap that object so that you modify the code

  • It is most likely that SetWindowsHookEx API is creating duplicate events; Report to the teamplayer because the team player is doing something complicated with many rats; They can be interested in deciding it by their side at some point

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -