This Question is Answered

2 "helpful" answers available (2 pts)
16 Replies Last post: Oct 5, 2007 5:07 PM by Serge Piletsky   1 2 Previous Next
  11 posts since
Feb 7, 2007
Currently Being Moderated

Feb 7, 2007 6:25 PM

Mouse Hook receiving events when there is no activity

Hi,

 

I have a sample application that registers for keyboard and mouse hooks and does simply a system.out when one is received. Once enabled, everything works fine, however if you dont touch the mouse and keyboard for a few minutes eventually you get some callbacks for events that have not occured. Is there any explaination as to why this happens or could it be a bug?

 

Thanks,

 

Alex Kritikos

Serge Piletsky TeamDev Ltd. 996 posts since
Apr 24, 2006
Currently Being Moderated
1. Feb 7, 2007 9:08 PM in response to: Alex Kritikos
Re: Mouse Hook receiving events when there is no activity

Hi Alex,

 

Frankly speaking, this is first such case in my practice. May be this is really because of bugs... real ones? Joking of course

 

If these were mouse events and you have an optical mouse, then probably it can be explained by fact that some optical mouse can produce some random 'mouse move' events even if nobody touches them. We've just discussed here this guess and many of us saw such strange behavior. Could it be the cause in your case?

 

-Serge

Serge Piletsky TeamDev Ltd. 996 posts since
Apr 24, 2006
Currently Being Moderated
3. Feb 9, 2007 4:31 PM in response to: Alex Kritikos
Re: Mouse Hook receiving events when there is no activity

Hi Alex,

 

Yes, please attach your example so we can test it. Because I was unable to reproduce this problem using our examples.

 

Also, is this problem reproducible on some particular computer only or you could reproduce it on different machines? What version of JNIWrapper do you use?

 

-Serge

Serge Piletsky TeamDev Ltd. 996 posts since
Apr 24, 2006
Currently Being Moderated
5. Feb 9, 2007 9:36 PM in response to: Alex Kritikos
Re: Mouse Hook receiving events when there is no activity

Thanks Alex, I was able to reproduce the problem several times, but I got only sporadic mouse events. I think this may happen because of multiple install/uninstall operations. Theoretically it should not happen if you install hooks only once.

 

Anyway, I will investigate this problem and let you know the solution.

 

-Serge

Serge Piletsky TeamDev Ltd. 996 posts since
Apr 24, 2006
Currently Being Moderated
7. Feb 16, 2007 8:33 PM in response to: Alex Kritikos
Re: Mouse Hook receiving events when there is no activity

Hi Alex,

 

Please try the attached WinPack library and let me know results.

 

-Serge

Attachments:
Serge Piletsky TeamDev Ltd. 996 posts since
Apr 24, 2006
Currently Being Moderated
8. Feb 23, 2007 2:10 PM in response to: Alex Kritikos
Re: Mouse Hook receiving events when there is no activity

Hi Alex,

 

I'm just wondering if you had a chance to test this update. I would greatly appreciate your feedback on it.

 

-Serge

Serge Piletsky TeamDev Ltd. 996 posts since
Apr 24, 2006
Currently Being Moderated
10. Feb 26, 2007 4:00 PM in response to: Alex Kritikos
Re: Mouse Hook receiving events when there is no activity

Hi Alex,

 

Thanks for the information, I'm glad it helped.

 

This update is actually WinPack 3.5 plus several fixes (including the fix Hooks API) and improvements that we made to make WinPack "Vista ready". We are planning to release WinPack 3.6 soon. So I think you can use it along with JNIWrapper 3.5 without any problem. Should any problem appear just let us know.

 

-Serge

Serge Piletsky TeamDev Ltd. 996 posts since
Apr 24, 2006
Currently Being Moderated
13. Oct 5, 2007 12:57 PM in response to: Alex Kritikos
Re: Mouse Hook receiving events when there is no activity

Hi Alex,

 

Sorry for the delay in getting back to you.

 

From the description that you have provided it seems that this problem depends somehow on event notification mechanism (using the EventObject class) from native library to Java side. Actually you can find the details of this implementation in Hook.HookEventLoop class, which is available in WinPack distribution archive.

 

In order to find and fix this problem I will probably need the complete test application that reproduces this issue. Can you please provide such example?

 

Alternatively, I think you can try attached LowLevelMouseHookSample.java example which implements low level mouse hook using JNIWrapper without Hook API from WinPack library. Please note that this example is not included to WinPack examples yet. We will add it to WinPack in the next version along with LowLevelKeyboardHookSample.java.

 

Btw, did you try Hook.FOREGROUNDIDLE hook in order to determine idle state?

 

-Serge

Attachments:

More Like This

  • Retrieving data ...