Hook for Input Panel/Mouse Windows CE

E

Emil

I develop an application for Windows CE 5.0 Device and actually I need just
to observe if the user makes no inputs (over Input Panel or mouse click) for
more than “X†minutes on the application. In this case the user will be
logout from the application.
Usually in this case I install a hook (SetWindowsHookEx) for keyboard and
mouse and … all fine. But this seems to not work on Windows CE 5.0. The hook
works of course on the normal .Net, also on the mobile emulations, but it
doesn’t work on the Windows CE 5.0 device (SetWindowsHookEx - fails). Some
people say that SetWindowsHookEx doesn’t work on Windows CE, but I never
found such an affirmation on Microsoft sites. Is it something special I need
to consider in this case?
Maybe I’m on the wrong way, but know somebody any solution for my purpose? I
guess I’m not the first developer which needs to intercept inputs over Input
Panel / Mouse on Windows CE. It is an WindowsForm Application with many Forms.
For any idea thank you in advance! I develop in C# but also in C++ is no
problem to understand.

Best Regards,
Emil
 
P

Paul G. Tobey [eMVP]

Windows CE != Windows XP, so hooks are generally not supported (low-level
keyboard and journaling hooks are actually there, but pretty much
undocumented). What device is this? One of your own design? If so, you
might check with the operating system developers to see how detection of
user interaction, mouse or keyboard, is reported. There might be an event
that you can catch, etc. For example,
HKEY_LOCAL_MACHINE\SYSTEM\GWE\ActivityEvent might indicate the name of an
event that would tell you this...

Paul T.
 
E

Emil

Thanks a lot for your reply. In the meantime I found a very good solution
using the OpenNetFC, IMessageFilter and Application2 and it works perfect.
Best Regards,
Emil
 
P

Paul G. Tobey [eMVP]

That will only detect keypresses and mouse actions in *your* application.
If the user brings some other application to the front and does a bunch of
operations, your application will still lock. Now, that might be what you
want, but you should be aware that you're not seeing *all* user actions
doing things on a per-window basis like that (same would be true if you
bring up a dialog in your application).

Paul T.
 
E

Emil

On the device runs only our application and the user cannot reach other apps.
Also there are no modal dialogs and messages. So it works. Thanks again!

Best Regards,
Emil
 
T

Tom

Is there a way to achieve a "hook" for all user input? We need a behaviour
similar to the device lock, but no the very same, unfortunatelly - the
application has to be visible during the "lock" and no keyboard presses
should be processed, especially the hardware ones. We're using VC++.

Any help would be appreciated!
 
E

Emil

For a normal desktop PC it's not a problem you can install application or PC
wide hooks, but on WinCE I found no way to do this. The "SetWindowsHookEx"
seams to not work properly.

Best Regards,
Emil
 
P

Paul G. Tobey [eMVP]

It works properly, although perhaps not the way you'd like. Windows CE is
not and never has been a derivative of desktop Windows.

As for the actual question, yes, you can use a special journaling hook and
catch all, or at least most, of the input. However, you'll have to get the
source code for Windows CE to really make anything out of it. You might
take a look at this thread, though:

http://groups.google.com/group/micr...5/a71c6c666cd5dac1?lnk=st&q=#a71c6c666cd5dac1

Generally, I'd try really hard to adjust the requirements not to necessitate
grabbing all user input. The system doesn't expect you to do that, doesn't
provide a documented way to do it, as a result, and is susceptible to you
screwing things up in a serious way, if you do.

Paul T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top